🦋 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.
lucs Given ⌊class Foo { method foo { "SNOO" }; method diehow { self.foo ~ $.foo } }⌉, how should I think about the difference between ⌊self.foo⌉ and ⌊$.foo⌉? 01:39
guifa_ self requires an instantiated value 02:33
basically, self is guaranteed to be a non-type object 02:34
perryprog For April Fools we should've said calling .WHAT on a string will now be an alias for .uc 02:38
guifa_ err actually it doesn't require an instantiated value. 02:47
nm
lucs Yeah, I just built this, I don't quite (at all actually understand the difference: 02:48
Yeah, I just built this, I don't quite (at all actually) understand the difference: 02:49
gist.github.com/lucs/259e6aad61651...95625c044d
guifa_ there's no difference in the calls themselves there 02:51
method foo { … } is really internally the equivalent of sub foo (::CLASS:_ \self:) { … } 02:52
when you call a method, the first argument is always set to the invocant 02:53
in your Foo, it's an instance of Foo. In your Niy, it's the type object 02:54
lucs Are self.foo and $.foo always interchangeable\
?
(in the same context)
Because hey, I'm lazy, I'll use $.foo all the time if I can ;) 02:55
guifa_ per the docs: `$.a will be equivalent to self.a.item or $(self.a)`
lucs I saw that, but they're talking about attributes I think, not necessarily methods. 02:56
guifa_ same logic applies 02:57
m: class Foo { method a { 1,2,3 }; method b { .say for self.a }; method c { .say for $.a } }; Foo.b; Foo.c;
camelia 1
2
3
(1 2 3)
lucs Aha, I see. 02:59
(with my eyes, that is -- I'll need to think a bit more :-) ) 03:00
lucs guifa_: Okay, got it. 03:19
Thanks for the explanation and the excellent example.
pelevesque So $.a is like self.a.item or $(self.a), but not like self.a The $ creates a kind of or literally a container? I get it with attributes, but for methods, does $.myMethod have advantages over self.myMethod? 05:40
Nemokosch For what it's worth, $.a and self.a are always method calls 07:36
There is no public access to attributes 07:38
In the Rakudo sources, you can see that $.a is really just "gimme the result of the method call to a, in a container" 07:41
You could use @.a and you'd get the same result, with .list called on it 07:42
Or %.a and then .hash is applied 07:43
Even you do has $.foo, that sets up a (private) attribute $!foo and a (public) method foo that returns $!foo 07:45
S /Even/Every time
This is why you can do is rw stuff at a declaration like that: it is used for generating the method 😉 07:48
Geth ecosystem/main: 4134c9ac88 | (Elizabeth Mattijsen)++ | META.list
Remove Lingua::EN::Syllable

It now lives in the fez ecosystem
10:18
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/04/03/2023-14-fulldist/ 11:39
Xliff \o 11:44
m: say "'Hello World'" ~~ / \" (.*?) \" | \' (.*?) \' /;
camelia 「'Hello World'」
0 => 「Hello World」
Xliff m: my token in-quote { \" (.*?) \" | \' (.*?) \' }; say "'Hello World'" ~~ / <in-quote> /; 11:45
camelia Nil
Xliff Why first but not second?
m: my token inQuote { \" (.*?) \" | \' (.*?) \' }; say "'Hello World'" ~~ / <inQuote> /; 11:46
camelia Nil
Nemokosch tokens don't backtrack 11:53
m: my regex in-quote { " (.?) " | ' (.?) ' }; say "'Hello World'" ~~ / <in-quote> /;
Raku eval 「'Hello World'」 in-quote => 「'Hello World'」 0 => 「Hello World」
Nemokosch I guess it doubled down on '' when it matched the first apostrophe 11:55
Xliff Nemokosch++: Thanks! 12:00
Nemokosch Mind you, I'd also like to know what "doesn't backtrack" means in practice 12:01
buuut it definitely makes the difference here 😅 12:02
you know, something is odd about this. I'm using similar "grammars" (composed regexes, at least) all the time, with token 12:23
m: my token inQuote { \' (.*?) \' }; say "'Hello World'" ~~ / <inQuote> / 12:28
Raku eval Nil
Nemokosch so this doesn't match
m: my token inQuote { \' <(.*?)> \' }; say "'Hello World'" ~~ / <inQuote> /
Raku eval 「'Hello World'」 inQuote => 「Hello World」
Nemokosch but this matches???
m: my token inQuote { \' .*? \' }; say "'Hello World'" ~~ / <inQuote> / 12:29
Raku eval 「'Hello World'」 inQuote => 「'Hello World'」
Nemokosch and this also does...
Xliff Nemo: Matches, but looks like it doesn't capture. 12:42
No $0 12:43
669
Oops.
Nemokosch well, you can still get the whole content from $/
but it would be interesting to know why the capture group suddenly ruins the matching 12:44
anyway, I wrote this down at least, whether it's a bug or a feature 12:47
Geth Raku-Steering-Council/main: 194563ac65 | (Salve J. Nilsen)++ (committed using GitHub Web editor) | minutes/nis2-cra-intro.pdf
Add slides for NIS2/CRA intro presentation

  - PDF slides for Salve's presentation on NIS2/CRA and community ramifications.
  - Feel free to reach out to Salve with questions.
13:09
Raku-Steering-Council/main: 33a56b3161 | (Salve J. Nilsen)++ (committed using GitHub Web editor) | minutes/20230401.md
Add link to Salve's NIS2/CRA presentation PDF
13:10
Voldenet maybe it would be nice if readme.org was supported in raku.land raku.land/zef:andinus/Template::Nest::Fast 15:02
[Coke] Do we have some kind of org processor in the ecosystem 15:16
?
[Coke] Voldenet: gitlab.com/raku-land/raku-land/-/issues/37 15:29
Voldenet so there is an issue, but there's no orgmode parser 15:37
[Coke] looks like they were going to just shell out to emacs. 15:44
lucs Reading the docs for type_captures (docs.raku.org/routine/type_captures.html), in the ⌊sub a(::T ::U $x) ⋯⌉ example, what is the point of the ::U? 16:08
Voldenet m: sub a(::ANY ::THING $x) { (ANY, THING, $x).say }; say a(1) 16:56
camelia ((Int) (Int) 1)
True
Voldenet m: sub a(::ANY ::THING ::YOU ::WANT $x) { (ANY, THING, YOU, WANT, $x).say }; say a(1)
camelia ((Int) (Int) (Int) (Int) 1)
True
Voldenet I know what it does, but I don't know what's the point though 16:57
m: sub a(::first $x, first ::second $y, second $z) { (first, second, $x, $y, $z).say }; say a(1, 2, 3) 16:59
camelia ((Int) (Int) 1 2 3)
True
Voldenet maybe something like that makes sense
m: sub a(::first $x, first ::second $y, second $z) { (first, second, $x, $y, $z).say }; a(Any, 2, 3) 17:01
camelia ((Any) (Int) (Any) 2 3)
Voldenet Maybe it starts making a bit more sense now 17:02
japhb Copying over from #raku-dev, since I realized some of the Mac folk may not be in that channel: 17:15
If anyone here is using a Mac, I would super-appreciate some screenshots of Mac terminal(s) running `terminal-quick-test` from github.com/japhb/Terminal-Tests (`zef install Terminal::Tests`)
I'm trying to get a rough idea of how terminal Unicode handling is working cross-platform.
So far I have gnome-terminal, gnome-terminal + GNU Screen, xterm with various configurations, and Windows Terminal under Windows 10 (though that one's slightly out of date; I've added to the test pattern since then).
FWIW, Windows Terminal under Windows 10 without enabling UTF-8 support is ... an interesting mess. Actually pretty decent with UTF-8 turned on properly (why in the world would this be off by default?!?)
lucs Voldenet: Your last example, although somewhat contrived, appears legit, 17:48
but what I don't get is, given (::T ::U $x) for example, how can ::T and ::U ever be different, and if they can't, what's the point of the ::U?
[Coke] japhb: dumped a bunch of sends to raku-dev 18:06
japhb Saw them, thank you! 18:11
lucs (repeating from earlier:) Reading the docs for type_captures (docs.raku.org/routine/type_captures.html), in the ⌊sub a(::T ::U $x) ⋯⌉ example, what is the point of the ::U? 18:46
In the spirit of Cunningham's law, I believe I will edit the docs to remove the ::U in that example. 18:47
lizmat lucs++ 18:53
coleman japhb: If you haven't already, you might make a Reddit post about this 20:24
(to solicit testing from Mac users)
japhb Oh right, I have a Reddit account, I totally forgot about that. 20:28
0.0.4's README now has the screenshots provided by [Coke]++ and lizmat++ 20:31
japhb coleman: Took your advice: www.reddit.com/r/rakulang/comments..._patterns/ 21:06
japhb Awww, Reddit doesn't do :emoji: codes? 21:07
[Coke] japhb: you might want to add the test version in the outputs. 21:39
japhb Well gee, that would be intelligent, wouldn't it? ;-) 21:58
japhb thinks about where he wants to fit that in for screenshot-friendliness 21:59