🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
Xliff m: my $p = Promise.in(100).then({ say "Hi!" }); $p.break; $p.status.say' 09:51
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> ({ say "Hi!" }); $p.break; $p.status.say⏏'
expecting any of:
infix
infix stopper
statement end
statement …
Xliff m: my $p = Promise.in(100).then({ say "Hi!" }); $p.break; $p.status.say
camelia Access denied to keep/break this Promise; already vowed
in block <unit> at <tmp> line 1
Xliff m: my $p = Promise.new; $p.in(100).then({ say "Hi!" }); $p.break; $p.status.say
camelia Invocant of method 'in' must be a type object of type 'Promise', not an
object instance of type 'Promise'. Did you forget a 'multi'?
in block <unit> at <tmp> line 1
Xliff m: my $p = Promise.in(100).then({ say "Hi!" }); my $v = $p.vow; $p.status.say 09:52
camelia Access denied to keep/break this Promise; already vowed
in block <unit> at <tmp> line 1
Xliff So if I'd like to use a promise as a timeout mechanism... what's the trick to getting a vor out of Promise.in?
lizmat looking at the code, it looks like it is using a vow to allow the Promise to be kept by the timing mechanism only 09:56
so why would you need another vow?
Xliff No. I'd want a way to cancel a Promise.in() 09:57
That way it could funciton as a timeout mechanism.
That might be mauling Promise a bit though, so if you have another suggestion, I would greatly appreciate it! 09:58
lizmat well, usually you'd use the Promise.in together with another Promise that you *can* keep, and then use .any
or you could go directly to the scheduler: docs.raku.org/routine/cue
Xliff Yeah. I think it's the scheduler for this one. Using await in GTK apps is a good way to lose hair! 10:11
lizmat I think raku.land/zef:finanalyst/GTK::Simple even uses its own scheduler for GTK events 10:22
github.com/Raku/problem-solving/issues/383 11:04
github.com/Raku/problem-solving/issues/384 11:06
nemokosch I'm immensely thankful for 383 11:13
oh my god, this is exactly the opposite direction xD 11:19
lizmat ah?
nemokosch "no version is not bleeding edge enough"
why...
the problem is actually what you wrote down in the comment... 11:20
if the language is allowed to shapeshift without the versioning pragma, it should produce a warning at the very least
lizmat well you didn't specify a version, so you didn't care 11:21
or do you mean: there should be a warning every time you run code without a version indicator ? 11:22
nemokosch this whole mindset is so unfriendly 11:23
"you apparently didn't care if your code works or not - haha, I put a trap there, now you are caught" 11:24
this would be quite passive-aggressive in a universe where teaching Raku is ten times better
let alone in the current circumstances
lizmat how would this be worse than having someone now write a lot of code (without version) with 6.d semantics 11:25
nemokosch what happened to "it would be better to fix the language than the user?"
lizmat and then having a compiler upgrade that makes 6.e the default version, and the code breaks ?
nemokosch if it's consensually the right thing to specify use version, then let's enforce it
lizmat how would that work in the REPL or oneliners ? 11:26
tbrowder__ for module distros, the META shows the specific version
nemokosch the REPL doesn't work well anyway 11:27
the oneliners can have a flag, and also, why are we worrying about non-compunits all of a sudden, rather than the default for 99% of cases?
like really, point out the error in my reasoning 11:28
lizmat I'd rather this be done in the issue 11:29
to keep it in one place
nemokosch to be honest, I have bad experience with issues... but so be it 11:30
tbrowder: have you seen my comments on the File::Find PR? 12:45
Could you take a look at them?
hythm m: dd "A", "🦋" ## is there a way to tell if a character is half or double width (like the difference between these two)? 13:12
camelia "A"
"🦋"
lizmat hythm: I think japhb has an algorithm for that in raku.land/zef:japhb/Text::MiscUtils 13:16
maybe not directly, but definitely internally :-) 13:17
hythm lizmat, Thanks, will check it out 13:19
antononcube I would be nice if “Text::MiscUtils” and “Text::Utils” are combined into one package.
guifa_ ugh looks like i developed a parser for alphabets in cldr only for them to be about to use a new format in v44 ... to be released in like one month =/ 13:52
lizmat did the development of that parser teach you anything ? 14:09
guifa it taught me why they changed the format for v44 ^_- 15:13
guifa the new format is super easy too as long as they don't encode any literal combining characters and escape them properly 16:42
lizmat guifa: well, that's something :-) 17:18
guifa Although I now realized that all the work I did to try to make things more efficient for chinese and japanese amounte to a minimal savings 17:23
There were only about 200-300 characters that were abbreviated out of a list of about 2200
go me, much efficiency, such smarts
gfldex lolibloggedalittle: gfldex.wordpress.com/2023/09/10/do...segfaults/ 17:54
Xliff gfldex: And I just left a comment... 18:31
Xliff Given this code: class A { method b { say whereAmI; }; }; whereAmI.say; class B { method c { whereAmI.say }; }; 21:02
How can I make it so that the whereAmI sub prints "A" on the fist occurrence; "main" on the second and "B" on the third? 21:03
MasterDuke check the depth of the callstack? 21:06
gfldex Xliff: You be fighting the inliner. I'm afraid you will have to wait for RakuAST macros for that one. 21:10
japhb Xliff: I can't comment there (no account), but see github.com/Raku-MUGS/MUGS-UI-CLI/b...kumod#L360 and following -- the breakdown that gfldex is doing is a subsignature, which can be separated out into a signature object that you can `where` with, which I do with `$common-args`. 22:21
tonyo do we have examples anywhere of entirely replacing the language for the rest of the file instead of doing mixins/slang? 22:22
eg once i do `use <something>` i want the rest of the file to be run through <something>'s actions
Xliff Ooooooooooo 22:26
japhb: So you can decomp via a where clause and a signature?
[Coke] tonyo: perhaps with "unit" 22:32
tonyo [Coke]: what do you mean?
i want to redefine $*LANG to use a custom grammar/actions only (and not mixin with MAIN) 22:33
[Coke] I have never tried it, but perhaps you could do a unit <something>; at the top of the file that imported the slang.
I don't think you can do that with raku 22:34
[Coke] Can I ask: what are you trying to do? 22:34
[Coke] like, the use case you're trying to solve, not the technical problem you posed. 22:34
tonyo i'm only trying to solve that technical problem, i thought it might be an interesting talk to push regarding raku regexes/grammars 22:35
so i came up with a toy syntax and wondered how i might make it possible to run: use <some-lang>; <the rest of the file is written in lisp> 22:36
my guess is it needs to go down to NQP and generate AST but wondered if there was another solution 22:37
[Coke] if you want "the rest of the file", I think the syntax for things like that is "unit"; if it's use, it's lexical, so doesn't have to be rest of file 22:40
but sounds like it'd be a new thing. 22:42
tonyo ah so possible maybe on something like `use myslang { <capture this somewhere in myslang and process it> }`
[Coke] (that is, not covered by existing C<unit>s)
Right, that could work (but then it'd be a slang probably?) 22:43
... which you implied, nevermind. :)
tonyo hmm, i'll give that a shot, it seems like kind of interesting way to expand the ecosystem 22:46