|
02:26
sibl joined
02:50
sibl left
04:05
human-blip left
04:07
human-blip joined
04:43
sibl joined
07:12
sibl left
07:19
sibl joined
08:36
sibl left,
sibl joined
09:12
dakkar joined
10:26
sibl left
10:27
sibl joined
|
|||
| lizmat | habere-et-disper: there is no syntax for that afaik | 10:35 | |
|
10:47
sibl left
|
|||
| dakkar | lizmat: closest I can get to an anonymous hash with a default values is `do-whatever(do {my %temp is default(12) = %(aaa=>1)})` which is a bit ugly… | 11:03 | |
| lizmat | that's a block returning a hash with a defaukt | 11:04 | |
| *default | |||
| dakkar | yes, which should be indistinguishable from a anonymous hash, right? | ||
| lizmat | m: dd (my % is default(42) = aaa => 1)<bbb> # shorter | 11:06 | |
| camelia | element of %{'bbb'} = 42 | ||
| lizmat | but that's not really syntax for an anonymous hash with a default | ||
| that's just a hash with a default without a name | |||
| :) | 11:07 | ||
| dakkar | oh, I had forgotten you can declare nameless variables | 11:10 | |
| could we have a `but default(…)`? | 11:16 | ||
| lizmat | m: sub infix:<but>(\a,\b) {dd a, b }; %(:a, :b) but 42 # that could work | 11:49 | |
| camelia | {:a(Bool::True), :b(Bool::True)} 42 |
||
| lizmat | but it would be wasteful, as it would need to re-create the hash | ||
| or at least all the containers in the hash | 11:52 | ||
| disbot11 | <librasteve> time for a lizmat module? | 11:59 | |
| lizmat | nah.... | 12:07 | |
| m: liz@LizyPro MoarVM-Profile % r 'sub default(\a) { a }; sub infix:<but>(\a,\b) {dd a, b }; %(:a, :b) but default(42) # letting someone else to feel this warrants a module | |||
| camelia | ===SORRY!=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> liz<HERE>@LizyPro MoarVM-Profile % r 'sub default expecting any of: infix infix stopper statement end statement modifier… |
||
| lizmat | m: sub default(\a) { a }; sub infix:<but>(\a,\b) {dd a, b }; %(:a, :b) but default(42) # letting someone else to feel this warrants a module | ||
| camelia | {:a(Bool::True), :b(Bool::True)} 42 |
||