00:24 ismustachio joined 00:28 ismustachio left 02:07 ismustachio joined 02:11 ismustachio left 02:38 ismustachio joined 02:42 ismustac1 joined 02:44 ismustachio left 03:00 ismustac1 left 03:06 ismustac1 joined, frost joined 03:57 ismustac1 left
Jaguart A question on Raku foo/style. There are so many ways to do things, it makes Perl feel a little like a straight-jacket 😮 08:25
m: ${ a => 1}.gist
m: say ${ a => 1}.gist; say ${ a => 1}.raku 08:26
Do you prefer to initialise your hashes using the gist or the raku? and a hint as to why? 08:27
frost m: a => 1 08:29
camelia WARNINGS for <tmp>:
Useless use of "a => 1" in sink context (line 1)
Useless use of constant value a => 1 in sink context (line 1)
frost m: {a => 1}.say 08:30
camelia {a => 1}
Jaguart @frost#6297 - oh yeah - sorry, unnecessary $ sigil, so you prefer ``{ a => 1 }`` over ``{ :a(1) }``? 08:34
frost I prefer a => 1
it's more clear
Jaguart how about in function-sigs as per ``$o.do-things( $str, :tweak, :unordered )`` where newbie me is assuming that the ``:`` is actually a pair defaulted to boolean-True? 08:37
vs ``$o.do-other( $str, tweak=>True, unordered=>True )`` 08:38
frost I like the shorter one :) 08:39
Jaguart Moving from Perl I actually like the ``:`` pair distinction - less temptation to view ``=>`` as a fat-stringifying-comma. The extra brackets do feel a bit more effort though. 08:41
frost in raku, you can choose the way you like in different places\ 08:46
gfldex m: say ‚123‘ ~~ m:2nd/\d/; 08:55
camelia ï½¢2ï½£
gfldex that is the main reason to have colon pairs in Raku
The other forms of colon pairs are desired side effects. 08:56
Jaguart so that's a pair in hiding? ``:2nd(/\d/)`` ?? 09:00
gfldex yes
Jaguart 🤯 09:01
gfldex m: sub infix:<op>(\a, \b, *%_) { say "got pairs: $%_"; }; 1 op 2 :2nd :99problems; 09:02
camelia got pairs: nd 2
problems 99
Jaguart wow - I guess that means ``Q:b 'Mind\nBlown'`` is actually a ``:b(True)`` 09:03
gfldex .oO(:Raku defaults to True) 09:06
Jaguart hmmm I dont grok that... ``:2nd`` seems to become ``nd=>2``??
Nemokosch Yes, it does become that
09:06 dakkar joined
If the value is a number, you can use it as a prefix of the key 09:08
So kg => 2 is :2kg in other words
gfldex m: sub foo(:$th){ say $th; }; foo :5th, :6th; 09:09
camelia 6
gfldex Please note that there is silent shadowing.
m: sub foo(:$th){ say $th; }; foo :5th:6th; 09:11
camelia 6
gfldex Also, the comma is optional. 09:12
m: dd :R:a:k:u;
camelia :R
:a
:k
:u
frost m: say :5th:6th
camelia
jaguart what is 'silent shadowing'? 09:13
gfldex m: say (:R:a:k:u).pairs;
camelia (0 => R => True 1 => a => True 2 => k => True 3 => u => True)
gfldex in :5th:6th th => 6 will discard th => 5. The last one wins. 09:14
jaguart so it's like a hash rather than two pairs 09:15
gfldex yes
m: say (my method me(){}).signature; 09:16
camelia (Mu: *%_)
gfldex In fact, they end up in a hash for methods.
jaguart Wow - I can see a whole new raft of bugs opening up before my eyes... :)
gfldex In practice, this seems not to matter. 09:17
jaguart I'm already learning to hate ``%h<<$var>>`` for returning slices - clearly my ``<<>>`` foo is not groked yet
hmmm - is that showing a default method signture - slurpy hash of Mu? 09:18
gfldex yes 09:19
jaguart Im still considering two successive pairs with the same name folding into one :o
gfldex m: say {;}.signature; (class C {}).^mro.say; 09:20
camelia (;; $_? is raw = OUTER::<$_>)
((C) (Any) (Mu))
gfldex Raku is basically an assortment of defaults. :)
Nemokosch What is %h<<$var>> 09:21
jaguart ``%h<<$k>>`` works better as ``%h{$k}`` - esp when $k contains spaces - took me an hour to debug that <<$k>> was returning a slice of Any,Any,Any rather than the value I was looking for. 09:23
Thank you all - you have raised my Raku - and eyebrows by at least a foot! 09:24
gfldex m: my %h is default(Nil); my $stuffzs = 1,2,3; dd %h«$stuffzs»;
camelia WARNINGS for <tmp>:
Useless use of constant integer 3 in sink context (lines 1, 1)
Useless use of constant integer 2 in sink context (lines 1, 1)
Nil %h{'1'} = Nil
gfldex m: my %h is default(Nil); my $stuffzs = (1,2,3); dd %h«$stuffzs»; 09:25
camelia (Nil, Nil, Nil)
gfldex m: my %h is default(Failure.new('bad‼')); my $stuffzs = (1,2,3); dd %h«$stuffzs»;
camelia (Failure.new(exception => X::AdHoc.new(payload => "bad‼"), backtrace => Backtrace.new), Failure.new(exception => X::AdHoc.new(payload => "bad‼"), backtrace => Backtrace.new), Failure.new(exception => X::AdHoc.new(payload => "bad‼"), backtrace =>…
gfldex Any is the default default. If that is not useful in your usecase, you are free to change the default. 09:26
jaguart It was more like: 09:27
m: my $k='a b c';my %h = ( 'a b c' => 'yeah');say %h<<$k>>;say %h{$k};
camelia ((Any) (Any) (Any))
yeah
jaguart so more that I was getting a slice of Nil when I was using keys with spaces 09:28
oh I like your slice of Failures - nice 09:29
gfldex Sadly, the stacktrace doesn't point to the right place. 09:30
And is default() doesn't take a callable. What I would really like it to take. 09:31
jaguart :pray: Many thanks for the light. As its nearly bed-time in Australia, I shall dream of butterflies 09:34
frost m: my $l = 'a b c'; say <<$l>> 09:36
camelia (a b c)
frost m: my $l = 'a b c'; .say for  <<$l>>
camelia a
b
c
gfldex If you think in functional terms, a lot of stuff makes sense in Raku. 09:37
11:33 ismustac1 joined 11:37 ismustac1 left 13:52 frost left 14:08 ismustac1 joined 14:16 ismustac1 left 14:18 ismustac1 joined 14:54 ismustac1 left 14:55 ismustac1 joined
guifa jaguart thankfully, few people use %foo«$bar» in practice. Personally (and most I know) tend to still use %foo{$bar}. guillomets are tough for anyone to type if it's not on their keyboard, and actual double < > takes up too much space XD 15:52
lizmat jaguart: version 0.0.9 of Zef::Configuration now supports: zef-configure add-repository tag url --name="Longer name for repo" 16:46
jaguart: and also: zef-configure remove-repository tag
people should now be set to create their own (company) ecosystem to work with Raku 16:51
17:24 ismustac1 left 17:27 ismustac1 joined 17:37 dakkar left 17:40 ismustac1 left 17:49 ismustac1 joined 19:40 ismustac1 left 19:59 ismustac1 joined 21:14 ismustac1 left 21:23 ismustac1 joined 21:59 ismustac1 left 22:25 ismustac1 joined 22:30 ismustac1 left 23:04 ismustac1 joined 23:09 ismustac1 left