🦋 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.
00:00 reportable6 left 00:02 reportable6 joined
vrurg I don't think it'd be widely requested though. Most of the time success of a loop is so much context-dependent. 00:03
guifa Yeah. It's just a thing that apparently python does. for { search } else { search failed because would have returned/ended } 
I actually just ran into one where for { do something } else { no iterables } would have been nice though 00:04
Nemokosch that's almost suspicious 😄
the logic of it is quite ugly in itself, only doing something when something else ran successfully exactly zero times 00:06
guifa instead I have a "if @foo { for @foo {…} } else { … }"
Nemokosch are you sure it's necessary? 00:07
guifa It makes the logic everywhere else much messier 00:08
Nemokosch this is a bit vague but I strongly suspect an XY problem somewhere. It really seems like an arbitrary distinction 00:11
mind you, the XY problem can be a language design problem - cue "why isn't there a unified way to reset a variable"
one of the "cardinal sins" of Nil 00:12
guifa It's a sub that processes a list of items. If it's empty, it needs to do something different. I'm trying to keep code as readable as possible. Ultimately, it means that the sub process-items needs to do an empty check. But because of where the sub is called, the logic gets very messy very fast putting the if / then further upstream 00:16
right now I just do sub foo { return alternative unless @foo; for @foo { … } }
tonyo nemokosch: python has for else
tellable6 tonyo, I'll pass your message to Nemokosch
guifa tonyo yeah, but it works differently
tonyo in what way 00:17
gist.github.com/tonyooooooo/07db20...df6ec961a1
guifa tonyo: the else is run if the loop exits without a break 00:18
tonyo i see the distinction 00:19
(now)
Nemokosch > If it's empty, it needs to do something different. 00:20
it's tempting to ask why that is because that might be the actual problem 00:21
guifa it's complicated to explain, but I can assure I've explored alternatives and they're messy 00:22
Nemokosch since Anton already kind of made me out to be some Python fanboy, let me cite "the Zen of Python" 00:24
"If the implementation is hard to explain, it's a bad idea."
guifa I don't think for { … } else { … } is hard to explain 00:25
it's very simple
exceptionally simple
Nemokosch but it shouldn't be necessary
guifa I'd say the same about python's for/else since I've never encountered a need for it
lol
Nemokosch it's about as ad-hoc as if there was a structure specifically for the one-element case
but it's really not complicated to say what it solves - searches 00:26
I didn't even need to explain because you figured it out on your own
guifa No, I only knew that because the docs said soa
I would just do @foo.first( { … } ) for that 00:27
there are many reasons for me to leave / not leave early, and the else there seems to only solve one of them
Nemokosch that's kind of avoiding the structure altogether 00:28
yes, exactly about your for-else
one arbitrary case
to reiterate: @foo.first({ ... }) is not syntax, it's just a built-in. One could hack this empty case for-else into a map-alike, if it is so useful 00:30
and again, if the "empty array case" is actually a "default/unset value case", then a solution would rather shadow the problem of default @values overlapping with legitimately empty arrays 00:32
guifa I don't see a distinction there: if an array has no items, it shouldn't loop, and sometimes you want to handle something else entirely 00:33
blogs.perl.org/users/damian_conway...ratch.html
twitter.com/ThePerlShop/status/117...2274515968 first comment to the tweet mentions "this is a common use case" and I'd agree. I come across it fairly often 00:34
I don't think I've ever come across the python use case
Nemokosch > sometimes you want to handle something else entirely but... why would you? 00:35
For the Python use case, it solves a well-articulated problem, it's not hidden in the nebulae of "sometimes"... 00:36
guifa that should be "handle it in a different way entirely"
We'll just have to agree to disagree. I think the Python use case for breaking out is rare (as I've never encountered a need for it), and the case for handling zero-element lists differently to be quite common. You find it the opposite. We can't change each other's experiences. 00:37
Nemokosch like really, I would like to see the "sometimes". I've already pointed out one reason the empty array needs to be handled specifically (because that's the default value of @variables) - and that is a bad reason to act upon. It's rather a problem of @variables overall. 00:38
So I do see a difference here. One has a clear purpose that can be addressed and discussed; the other may or may not have better approaches - we don't know because it's all too vague 00:39
guifa Again, we are just going to disagree on this, so it's better to move on.
Nemokosch It would have been good to provide similar level of elaboration on both sides even in order to eventually disagree but so be it 00:41
I actually would have been curious what makes a pattern that I can only see as a leaky abstraction, so common (if not my blind guess the default value), and unlike Python's for-else, it's not easy to even pose it as a question to ChatGPT or something, lol 00:46
tonyo i use it in python every day..but it does come with a lot of questions usually 00:53
i'd probably try to abuse that syntax to do stuff like `my @a = do for @some-input -> { $_ * $_ } else { qw<some sane default> };` 00:56
01:01 derpydoo joined 01:03 xinming left
Anton Antonov @guifa Promises, promises— provide the recording of tprc2022.sched.com/event/11neo 01:04
guifa I don't have the recording but can email you the slides!
msg me your email and I'll send along
Anton Antonov @guifa … please 01:05
@guifa Ah, ok.
guifa err, you're on the bridge, not sure if you can pm me
01:05 xinming joined
Anton Antonov @guifa I can find your email from GitHub? 01:06
guifa you can use my softastur.org email and I can respond back to you -- it's mateu@ 01:07
You've got mail 01:17
Anton Antonov @guifa Got it! 01:19
guifa feel free to ask me any questions 01:27
but hopefully it's mostly understandable as is
Anton Antonov @guifa Ok, thanks -- will do! 01:49
01:57 jmcgnh left 02:07 elcaro joined 02:08 jacob_c joined 02:19 sivoais left
jacob_c I'm trying to play around with SDL2::Raw but having issues when running the example programs given. It seems like some of the functions get exported to the program as expected, but some of them don't. For example, the program will recognize SDL_Init but complains that SDL_CreateRGBSurface is an undeclared name. But I can't see anything in the 02:28
Raw.pm6 code that would suggest why some functions work and others don't. Because of this, some programs run, like white-noise.p6, but others don't, like particles.p6.
Furthermore, if I just copy the Raw.pm6 code into a foo.pm6 in the same folder and tweak to the example program to something like "use lib '.'; use foo;" then everything works perfectly. (I installed the module using a simple "zef install SDL2::Raw".) It seems like something is acting up with the exporting of the function names. Any idea what the
issue could be?
Unfortunately, the only error message I get is a list of undeclared names. So I'm not even sure how to troubleshoot this. 02:33
===SORRY!=== Error while compiling /home/jacob/temp/particles.raku
Undeclared names:
    SDL_CreateRGBSurface used at line 28
    SDL_FreeSurface used at line 30. Did you mean 'SDL_Surface'?
    SDL_GetWindowSurface used at line 26
    SDL_LockSurface used at line 46. Did you mean 'SDL_Surface'?
    SDL_MapRGBA used at line 48
    SDL_UnlockSurface used at line 84
And one more thing I noticed when inspecting via two separate REPL sessions. 02:57
[0] > use lib '.'
Nil
[1] > use foo
Nil
[2] > SDL2::Raw::EXPORT::DEFAULT::.keys.elems
305
[0] > use SDL2::Raw
Nil
[1] > SDL2::Raw::EXPORT::DEFAULT::.keys.elems
298
So it seems there are 7 items exactly that get exported via my foo technique, but not through the normal SDL2::Raw.
(Hopefully I'm not spamming by having paragraphs of text here. I'm new to IRC.) 02:58
perryprog (Try to use a pastebin-like service if you can for pasting multi-line stuff)
jacob_c Ah, that makes sense. Thanks!
MasterDuke what version of rakudo do you have?
jacob_c Just installed the latest via rakubrew. 02:59
> Currently running moar-2023.02
I could open an issue on GitHub for SDL2::Raw, but I wanted to make sure I wasn't doing something silly first. 03:04
MasterDuke it's pretty late in europe, but you could trying pinging timo1 over in #raku-dev (the author of SDL2::Raw)
jacob_c That sounds good. I'll let it sit here for a bit, and maybe politely ping him in a day or two if there are no answers here. 03:07
perryprog That is unreasonably polite and patient 03:08
And suspiciously respectful of open-source package maintainers
jacob_c lol Next time I promise to be more demanding ;) 03:10
perryprog Good, good
03:10 rf left 03:19 razetime joined, sivoais joined 03:36 jmcgnh joined 03:52 razetime left 04:23 razetime joined 04:38 jacob_c left 04:44 discord-raku-bot left 04:46 discord-raku-bot joined 04:47 shmup left, shmup joined 05:29 razetime left 05:30 Sauvin left, Sauvin joined 05:35 nort joined 05:44 razetime joined 06:00 reportable6 left, reportable6 joined 06:12 jpn joined 06:17 jpn left 06:26 derpydoo left 06:32 abraxxa joined 06:34 Sgeo left 06:48 tea3po joined 06:51 teatwo left 07:00 jetchisel left 07:02 jetchisel joined 07:04 abraxxa left 07:34 abraxxa joined 07:37 Sussysham joined 07:44 Sussysham60 joined, Sussysham60 left 07:47 Sussysham left
Voldenet m: class Foo { method AT-POS($n) { $n }}.new; my @p is Foo; @p[42.54].say 08:00
camelia 42
Voldenet m: class Foo { method AT-KEY($n) { $n }}.new; my %p is Foo; %p{42.54}.say 08:01
camelia 42.54
Voldenet I guess that makes sense
08:07 Sussysham joined 08:47 Scotteh left, Scotteh joined 09:00 jpn joined 09:10 dakkar joined 09:28 abraxxa left 09:32 abraxxa joined 09:38 razetime left
guifa Yeah, the bracket postcircumfix coerces args to Int before calling AT-POS 09:47
m: class Foo { method AT-POS($n) { $n }}.new; my @p is Foo; @p.AT-POS(42.54).say
camelia 42.54
guifa but if you call it directly, coercion doesn't happen
10:38 linkable6 left, evalable6 left 10:40 evalable6 joined 10:41 linkable6 joined 10:52 derpydoo joined 11:01 Sussysham left 11:17 ab5tract joined 11:43 TieUpYourCamel joined
Voldenet it's very important to understand that Positional doesn't represent any linear order and that Associative is better at representing it 11:51
11:51 jmcgnh left
Voldenet it's not that intuitive 11:51
m: class Foo { method AT-POS($n) { $n }}.new; my @p is Foo; @p[-1].say
camelia ===SORRY!=== Error while compiling <tmp>
Unsupported use of a negative -1 subscript to index from the end. In
Raku please use: a function such as *-1.
at <tmp>:1
------> OS($n) { $n }}.new; my @p is Foo; @p[-1]⏏.say
Voldenet m: class Foo { method elems { 42}; method AT-POS($n) { $n }}.new; my @p is Foo; @p[*-1].say
camelia 41
exp could you explain how Positional doesn't represent a linear order? 11:59
do you mean because of the ability to do as you described 12:00
12:00 reportable6 left, teatime joined
exp and, if such behaviours are to be taken as canonical, is there anything in Raku that represents anything? Given how mutable everything is 12:00
12:00 reportable6 joined
lizmat I think it basically boils down to: if something is Positional, you can only use integer values to index into it 12:01
as opposed to just anything in the case of Asssociative
12:01 tea3po left
lizmat normally, negative integer values are not allowed, but you can provide your own AT-POS implementation that allows them 12:02
in fact, you can even provide an AT-POS implementation that could handle anything
exp indeed, but that seems rather oxymoronic, because you can effectively reimplement anything in Raku as far as I know 12:03
so it doesn't seem reasonable to say "X doesn't do Y" if by default, X is intended to do Y :)
lizmat for example. raku.land/zef:lizmat/Array::Sparse would map indices to hash keys
true
12:03 NemokoschKiwi joined 12:09 grondilu joined
grondilu m: class :: does Dateish { has $.data; }.new: data => "foo bar" 12:09
camelia Cannot call <anon|1>.new with these named parameters: data
in block <unit> at <tmp> line 1
12:10 perlbot left, simcop2387 left
grondilu I don't quite understand this error^ 12:10
Voldenet exp: it represents specific total ordering on non-negative integers and you can't reimplement that easily
exp Voldenet: what's the difference between specific total ordering and linearisation?
Voldenet m: sub postcircumfix:<[ ]>($container, $index) { … }; my @p; @p[-1].say 12:11
camelia ===SORRY!=== Error while compiling <tmp>
Unsupported use of a negative -1 subscript to index from the end. In
Raku please use: a function such as *-1.
at <tmp>:1
------> $container, $index) { … }; my @p; @p[-1]⏏.say
12:13 NemokoschKiwi left
Voldenet exp: specific one will accept only UInt and will define expectation of knowing length 12:14
exp ok but there's also Supplies aren't there for those without known length?
I guess I'm confused by what behaviour you expect 12:15
Voldenet I was expecting index to be passed without casting 12:16
it's practical to have infinite sets being positional, but things will break 12:17
m: my @x = 1..*; @x[*-1].say
camelia Cannot .elems a lazy list
in block <unit> at <tmp> line 1
Voldenet but of course, this has to fail
Nemokosch yes, this probably doesn't even make sense 12:30
12:33 derpydoo left
Voldenet m: class Foo { method AT-POS($n) { $n }}.new; my @p is Foo; @p[*..1].say 12:37
camelia MoarVM panic: Memory allocation failed; could not allocate 10240 bytes
Voldenet Not as expected 12:38
since index must be valid UInt, * must be 0 here, doesn't it 12:39
Nemokosch too magical, not magical enough 12:40
Voldenet m: class Foo { method AT-POS($n) { say $n; $n }}.new; my @p is Foo; @p[*..1].say
camelia Cannot convert -Inf to Int
in block <unit> at <tmp> line 1

Actually thrown at:
in method AT-POS at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet w-what ಠ_ಠ 12:41
OTOH Associative does exactly what I'd expect from Positional (*..1 will just keep calling AT-KEY for -Inf) 12:45
Nemokosch what did you change exactly? 12:49
Voldenet ` say $n; `
Nemokosch pfff 12:50
12:52 derpydoo joined 13:17 jpn left 13:21 grondilu left 13:24 jacob_c joined 13:42 jacob_c left 13:52 xinming left 13:54 xinming joined 13:59 jmcgnh joined 14:00 jpn joined 14:05 jpn left 14:10 jgaz joined
Geth raku.org: oneineight++ created pull request #182:
Replaced url of article on non-existent perl6.party
14:18
CCR/main: e14ce8fe2e | (Elizabeth Mattijsen)++ | 2 files
Update self-referential links
14:26
CCR/main: cdaa5de6b9 | (Elizabeth Mattijsen)++ | Remaster/Zoffix Znet/Part-2-A-Date-With-The-Bug-Queue-or-Let-Me-Help-You-Help-Me-Help-You.md
Oops, there shouldn't be a / there
14:28
14:31 jpn joined 14:32 Sgeo joined 14:49 jgaz left 14:51 jgaz joined 14:56 avuserow left
[Coke] TIL about Raku/CCR 15:06
coleman Brother, the only CCR I know is Creedence 15:07
yeee haw
15:12 spacekookie joined
tonyo from fresno ca 15:31
16:06 cfa joined
xinming my $str = do with $str { s/abc//; s/bcd/; s/xyz/; $_ }; # <-- In this example, How do we make a $str a copy? 16:10
my $str = do with $str-orig { s/abc//; s/bcd/; s/xyz/; $_ }; # <-- In this example, How do we make a $str a copy?
hmm, Just figured out something liek, my $str = do with (my $ = $str-orig) { ... }; 16:11
Nemokosch m: my $str = do with $str-orig -> $ is copy { s/abc//; s/bcd/; s/xyz/; $ }; dd $str; dd $str-orig; # I wonder 16:15
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Variable '$str-orig' is not declared at /home/glot/main.raku:1 ------> my $str = do with ⏏$str-orig -> $_ is copy { s/abc//; s/bcd
Nemokosch oh bruh 16:16
m: my $str-orig = 'abcdefghxyz'; my $str = do with $str-orig -> $ is copy { s/abc//; s/bcd/; s/xyz/; $ }; dd $str; dd $str-orig; # I wonder
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Unsupported use of /x. In Raku please use: normal default whitespace. at /home/glot/main.raku:1 ------> orig -> $ is copy { s/abc//; s/bcd/; s/x⏏yz/; $ }; dd $str; dd $str-orig; # I won
Nemokosch come on, these error messages are not relevant anymore... 16:17
dakkar or, you know, my $str = $str-orig.subst(/abc/,'').subst(/bcd/.'').subst(/xyz/,'')
(notice that the code xinming wrote won't compile because `s/foo/` is not valid syntax, it's missing the replacement bit) 16:18
Voldenet or `my $str = do with $str { S/abc//; s/bcd/; s/xyz/; $_ };`
m: my $str = do with ($_ = "xyzabcd") { s/abc//; s/bcd//; s/xyz//; $_ }; 16:19
camelia ( no output )
Nemokosch oh there were actual syntax errors 16:20
m: my $str-orig = 'abcdefghxyz'; my $str = do with $str-orig -> $ is copy { s/abc//; s/bcd//; s/xyz//; $ }; dd $str; dd $str-orig;
Raku eval Str $str = "defgh" Str $str-orig = "abcdefghxyz"
Nemokosch finally 👏 16:21
16:46 simcop2387 joined 16:47 perlbot joined 16:48 rf joined
rf Morning folks 16:49
Voldenet morning but it's 6PM here 16:53
dutchie but www.total-knowledge.com/~ilya/mips/ugt.html 16:59
Nemokosch it's not in effect everywhere 17:04
17:04 ab5tract left 17:05 ab5tract joined, simcop2387 left
rf @Voldenet it's about 10 AM here 17:06
17:06 simcop2387 joined
Voldenet I like UGT, it expresses the freedom of the internet 17:07
cfa m: say "good {now.DateTime.hour < 12 ?? 'morning' !! 'afternoon'}" 17:09
camelia good afternoon
cfa i guess technically 12:00:00 isn't after noon but hey 17:10
rf m: say "{ True ?? 'Good Morning' : 'Good Afternoon' }" 17:11
camelia ===SORRY!=== Error while compiling <tmp>
Please use !! rather than :
at <tmp>:1
------> say "{ True ?? 'Good Morning' :⏏ 'Good Afternoon' }"
expecting any of:
colon pair
rf m: say "{ True ?? 'Good Morning' !! 'Good Afternoon' }"
camelia Good Morning
rf :^)
cfa hee hee
exp no i think you're right cfa
it ticks over at precisely the stroke of 12 17:12
cfa m: say "$_, i said $_!" given 'good day' 17:13
camelia good day, i said good day!
tonyo cfa: only for an instance
instant*
17:24 Sauvin left
cfa m: say /"12:00:00"/ ?? 'lunchtime' !! .split(':')[0] < 12 ?? 'morning' !! 'afternoon' given now.DateTime.hh-mm-ss 17:25
camelia afternoon
17:32 Sauvin joined 17:36 abraxxa left 17:40 dakkar left 18:00 reportable6 left 18:01 reportable6 joined 18:11 jmcgnh left
[Coke] m: say 65/416 18:16
camelia 0.15625
18:28 nommef joined
nommef hello, possibly a stupid question, but why `[1, 2, 3].first(* < 0 && * > 0)` returns 1 and not Nil? 18:30
18:30 jmcgnh joined
[Coke] m: say [1,2,3].first({$_ <0 && $_ > 0}); 18:35
camelia Nil
18:35 abraxxa-home joined 18:36 abraxxa-home left
[Coke] m: say [1,2,3].first(* > 0 && * < 0); 18:36
camelia Nil
[Coke] m: say [1,2,3].first(* < 0 && * > 0); 18:37
camelia 1
Nemokosch * and * refer to two different positional parameters
[Coke] to be clear, I don't know the answer, but that fact that the first two give a different answer is probably a huge clue.
18:38 abraxxa-home joined
Nemokosch every occasion of * appearing in a "whatever-curried" expression is a new positional parameter 18:38
rf m: say [1,2,3].first(* > 0 and * < 0);
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> say [1,2,3].first(* > 0⏏ and * < 0);
expecting any of:
rf Is it actually called whatever curried?
Because I don't think that is currying
Nemokosch yes 18:39
cfa this doesn't seem to be the case here
m: (1).first(* == 0 && * == 2 && * == 3).say
camelia Nil
cfa m: (1).first(* == 0 && * == 2 && * == 1).say
camelia 1
cfa that's not taking three arguments 18:40
m: (1).first(* == 1 && * == 2 && * == 3).say
camelia Nil
Nemokosch could be that it's a && hack?
rf I think so
Nemokosch iirc it's a bit funny with whatever-currying
rf Whenever I see && I get suspicious 18:41
Nemokosch but anyway the general rule is that all appearances of the asterisk introduce a new positional parameter
cfa m: (* == 1 && * == 2 && * == 3)(1).say
camelia False
Nemokosch which is definitely not what the intention was here
cfa m: (* == 3 && * == 2 && * == 1)(1).say
camelia True
nommef ._.
cfa single argument expected, behaviour seems plain buggy to me 18:42
rf m: (* == 3 && * == 2 && * == 1).Signature.say
camelia No such method 'Signature' for invocant of type 'WhateverCode'. Did
you mean 'signature'?
in block <unit> at <tmp> line 1
Nemokosch truth be told, whatever-currying is not meant to be used for anything remotely complex
cfa m: (* == False && * == 1)(1).say 18:43
camelia True
cfa clearer,
m: m: (* != 0 && * == 1)(1).say
camelia True
cfa damnit, typo
m: m: (* == 0 && * == 1)(1).say
camelia True
Nemokosch m: * == 0 && * == 1 andthen .(0|1).say 18:44
Raku eval any(False, True)
Nemokosch && doesn't whatever-curry at all 18:45
rf m: { say * }(1);
camelia *
cfa m: (* == 3 && * == 2 && * == 1).signature.arity.say # for rf
camelia 1
lizmat re CCR: I would love to see someone make a really nice website for the Remaster dir :-) 18:46
nommef I had something like this: `@users.first(*<name> eq $name && *<pass> eq $pass)` and was very surprised it was only comparing passwords. I could log in with any invalid username and any valid password :D 18:47
18:47 teatime left
cfa i frankly find whatever stars confusing and unpredictable 18:48
18:48 teatime joined
cfa they're okay in very small code fragments but... yeah 18:48
Nemokosch re learning about CCR today - I called it... there is more content than people tend to assume, spreading awareness might give not only a moral boost but like better results at things
nommef yeah, they do seem a bit strange. lessen learnt - only use them in very simple ways 18:49
Nemokosch nommef: for now, the important thing is still that * doesn't reference the same parameter over and over but a new one every time
cfa also, nommef, your question wasn't stupid at all
18:49 grondilu joined, grondilu left
Nemokosch and that && doesn't whatever-curry, well... in mid term, I'd like to call that a bug rather than a feature 18:50
nommef so, I hit a combo :D
cfa Nemokosch, can you explain this behaviour? 18:51
18:51 teatime left, teatwo joined
Nemokosch like anyway, what sense does it make to parse * eq 'a' && * eq 'b' as (* eq 'a') && (* eq 'b'), two distinct code objects? can any code object be false at all? 18:51
cfa: it's probably beyond my knowledge but it comes up every now and then that && and || are kind of special because of the short-circuiting 18:52
there is some kind of compiler-level intervention 18:53
so that the arguments don't evaluate beforehand
cfa but the above behaviour resembles || rather than && short circuiting 18:54
m: m: (* == 0 && * == 1)(1).say
camelia True
cfa this should short circuit and not even test == 1
perhaps i misunderstood your point though 18:55
Nemokosch && returns the second argument if the first one is truthy, right?
lizmat yes
Nemokosch the first argument is a code object
lizmat m: say 0 && 42
camelia 0
lizmat m: say 1 && 42
camelia 42
Nemokosch m: * == 0 andthen .so.say 18:56
Raku eval True
cfa aha
Nemokosch it is True, and I suspect that it is always true, no matter what the exact expression was that constructed the WhateverCode
meaning && will give you the right side and || the left side 18:57
cfa so everything but the final branch is effectively optimised away here?
and then our argument is handed to that whatevercode instance?
18:58 perlbot left 18:59 simcop2387 left 19:00 jpn left
Nemokosch hm, I don't think it's "optimized away", it's rather a parser thing maybe? it's hard for me to tell without actually knowing how && is put in its place 19:00
rf Could be that && is making it infer that * is the same argument throughout 19:01
Nemokosch the way I understand it is that these operators take code "raw" when they are parsed
rf m: (* + *).signature.arity.say
camelia ( no output )
Nemokosch m: (* + *) andthen .signature.arity.say 19:02
Raku eval 2
Nemokosch you know, my understanding is that && does something similar to andthen
it operates on pieces on code rather than values 19:03
19:03 jpn joined, simcop2387 joined, perlbot joined
cfa yeah i guess (from a user perspective) this is confusing for two reasons 19:03
Nemokosch "take the left hand-side, evaluate it in boolean context - if it yields True, take the right hand-side, evaluate that as well and return it"
cfa one is that (* + *) has an arity of 2, while (* == 0 && * == 1) has an arity of 1
the other is the && behaviour with code objects, which is invisible and surprising behaviour 19:04
so that it's non-obvious
or rather, it's not obvious that this is an example of say 1 && 42
Nemokosch I'd like to try one example with snitch, hmm 19:05
nommef thank you all for explanation. it was not very apparent to me (still pretty green in raku) 19:06
19:06 NemokoschKiwi joined
nommef i am getting similar vibes like from `[1, 2, 1, 2].map(parseInt)` evaluating to `[ 1, NaN, 1, 2 ]` in JS :D 19:07
NemokoschKiwi m: use v6.*; (*.snitch.not || *.succ.snitch)(1)
camelia 1
NemokoschKiwi if `(*.snitch.not || *.succ.snitch)` was one expression, the second half should have evaluated, right? 19:08
19:08 jpn left
NemokoschKiwi m: use v6.*; (*.snitch.not.snitch || *.succ.snitch)(1) 19:08
camelia 1
False
NemokoschKiwi sure thing because the first half evaluates to False when you pass 1 to it
19:09 jgaz left
NemokoschKiwi m: use v6.*; (*.snitch.not.snitch && *.succ.snitch)(1) 19:10
camelia 2
NemokoschKiwi the second half ran, without any considerations to the first half 19:11
cfa at the very least, this seems worth documenting as a trap 19:12
if this is all WAI, a warning would be good
NemokoschKiwi I can also recall something from Liz that this is really a parser-level intervention, and calling &infix:<&&> just wouldn't short-circuit at all 19:14
lizmat indeed it won't the shirt-circuiting ops are really "macros" at the grammar level
the sub versions only exist so you can use them in meta-ops 19:15
but currently do *not* short-cicruit
*circuit
19:15 jgaz joined
NemokoschKiwi do you think short-circuiting over WhateverCode could be avoided with the RakuAST frontend easier? 19:17
19:17 jpn joined 19:19 NemokoschKiwi left 19:22 jpn left 19:33 cfa left 19:40 nommef left 19:46 abraxxa-home left 19:57 perlbot left, simcop2387 left 20:09 simcop2387 joined, perlbot joined 20:19 perlbot left, simcop2387 left, jpn joined 20:27 jpn left 20:28 perlbot joined 20:30 simcop2387 joined 20:42 jpn joined 20:44 ab5tract left 20:48 Guest74 joined, Guest74 left 21:00 jpn left 21:34 jmcgnh left 21:41 jmcgnh joined 21:49 jpn joined 21:53 jpn left 21:56 simcop2387 left, simcop2387 joined 22:01 raiph joined 22:12 simcop2387 left, simcop2387 joined 22:16 simcop2387 left 22:19 simcop2387 joined 22:22 simcop2387 left, simcop2387 joined 22:27 simcop2387 left 22:29 simcop2387 joined 22:34 perlbot left, perlbot joined 22:45 jpn joined 22:50 jpn left 22:56 perlbot left, perlbot joined 23:09 simcop2387 left, simcop2387 joined, jgaz left 23:16 simcop2387 left, simcop2387 joined 23:34 raiph left