6 Oct 2024 |
nahita3882 |
maybe the intention with * is that it is used with "quick" stuff and ternary isn't covered |
18:22 |
|
librasteve |
m: say (5, 4)[4 ≥ 3 ?? 1 !! 0] |
|
|
Raku eval |
4 |
|
|
librasteve |
m: say (5, 4)[2 ≥ 3 ?? 1 !! 0] |
|
|
Raku eval |
5 |
|
|
nahita3882 |
like *.attr, * <infix> sth, *[idx] etc. all works but ternary is too much? idk the details |
|
|
librasteve |
m: (5, 4)[*.say] |
18:23 |
|
Raku eval |
2 |
|
|
librasteve |
(5, 4)[(* ≥ 3).say] |
|
|
|
m: (5, 4)[(* ≥ 3).say] |
|
|
Raku eval |
False |
|
|
librasteve |
looks like ternary is a bug to me |
|
|
|
m: say (5, 4)[4 ≥ 3 ?? *-1 !! 0] |
18:24 |
|
Raku eval |
4 |
|
|
librasteve |
seems to be limited to use of * in the test of a ternary within an [] index |
18:25 |
|
|
if you agree I can log as a bug |
|
|
nahita3882 |
it doesn't work in [] but it doesn't work outside either |
18:26 |
|
|
not working in the sense that it doesn't produce a closure |
|
|
|
but instead evaluates to what the truthful part of the ternary gives immediately |
|
|
|
because the whatevercode is truthful |
|
|
|
like any other sub |
18:27 |
|
|
perl In [25]: (* > 3 ?? 2 !! -1).WHAT (Int) |
|
|
|
user (like Time Melon and probably us too) expects this to be still WhateverCode |
|
|
|
maybe a bug, maybe some technical detail (like ternary shortcircuiting), so it's up to you to file the bug but thanks if you take the time of course |
18:29 |
|
|
maybe shortcircuting is the thing: |
18:30 |
|
|
perl In [30]: (* >= 2) && 7 7 In [31]: (* >= 2) & 7 WhateverCode.new |
|
|
|
perl In [32]: ((* >= 2) & 7).(55) all(True, 7) In [33]: ((* >= 2) & 7).(-55) all(False, 7) |
18:31 |
|
|
i.e., with the all-junction, it did produce a closure, which we can call |
18:32 |
|
|
with the && logical-and (which shorcircuits), no closure yes direct evaluation |
|
|
timemelon |
ohh I see, the whatever code just doesn't include the ternary |
20:21 |
|
|
funky, I wonder if there's a list of what is and isn't included anywhere |
20:22 |
|
|
docs don't mention ternaries anywhere so idk |
20:27 |
|
|
thank you for letting me know why it wasn't working! |
|
|
7 Oct 2024 |
nahita3882 |
np |
07:07 |
|
|
there is a table in that link but it says when it stays as a Whatever object, the ternary et al.'s situation is different |
|
|
|
and indeed not documented there; maybe we can document the shorcircuting operators' behaviour with regards to * there |
07:08 |
|
|
somewhat unrelatedly: is it only me or others can also see unused and unnecessary scrollbars in the code snippets in the documentation's website |
07:10 |
|
|
e.g., |
07:11 |
|
|
cdn.discordapp.com/attachments/768...ce3c2& |
|
|
|
both horizontal and vertical |
|
|
|
maybe i should ask in the raku-doc channel |
|
|
lizmat |
and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/10/07/2024-41-knowlite/ |
16:52 |
|
8 Oct 2024 |
librasteve |
maybe it’s * as in Inf? |
04:41 |
|
vendethiel |
lizmat++ # all great proposals/tickets |
14:11 |
|
|
"Final" methods with no *%_ are very interesting |
14:12 |
|
ab5tract |
timemelon: I'm not sure why the docs don't include it but there is indeed a list in the Rakudo source |
17:42 |
|
|
github.com/rakudo/rakudo/blob/19a3...kumod#L312 |
17:43 |
|
lizmat |
hmmm isn't that already part of OperatorProperties ? |
17:48 |
|
|
if not, it probably should |
|
|
timemelon |
interesting! I don't see ?? on there, does it desugar to && somewhere along the line before this code? |
18:00 |
|
ab5tract |
timemelon: it's rather that it is not even considered for being "curried": github.com/rakudo/rakudo/blob/7d08...umod#L2895 |
18:33 |
|
|
it would need to have `is WhateverApplicable` there for that to be the case |
|
|
|
I don't think that ternaries are a good fit for being primed, though |
18:34 |
|