This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
01:10 hexology- is now known as hexology, razetime joined 02:30 teatwo left, teatwo joined, razetime left 02:31 razetime joined 03:01 teatwo left, teatwo joined 03:32 camelia left 03:38 camelia joined 05:16 siavash joined 05:42 teatwo left 07:06 lizmat joined 07:07 lizmat_ left, RakuIRCLogger left 07:53 siavash left 07:56 siavash joined 08:10 dakkar joined 08:24 razetime left 08:47 razetime joined 09:07 uzl[m] left 09:09 razetime left 09:11 razetime joined 09:41 lizmat_ joined 09:44 lizmat left 10:11 siavash left
librasteve deoac: good question ... and snonux is right ... here's how I would describe it... 10:45
(i) the 'token' declaration is (like 'regex', 'rule' and so on) just a special kind of 'class' declaration since raku tries to build on the same lego bricks 10:46
(ii) all declarations ('class', 'constant', 'sub', 'method' and so on) have a default scope -- specifically 'class' (and thus 'token') take package scope 10:51
(iii) as you know there are two kinds of scope that can be used by declarations: 'my' is lexical scope, 'our' is package scope 10:52
(iv) by making class default to our scope, raku can make it much neater to write modules as OO classes 10:53
instead of package P { class A is export { has $.a = 42 } }
you can just write 10:54
class A { has $.x = 42 }
I have put this in a gist so that you can get a better feel for it gist.github.com/librasteve/4229147...58cfc60973
(v) but ... especially in larger programs there is a need for both public classes (the API) and private classes to coexist (the hidden implementation details) ... so raku lets you compound 'my' and 'class' to override the default scoping behaviour with eg. my token { ... } 10:57
11:07 razetime left 11:08 razetime joined 11:09 razetime left 16:31 gfldex_ is now known as gfldex 16:37 dakkar left 16:45 razetime joined 16:50 razetime left 16:51 razetime joined 17:00 razetime left, razetime joined 17:44 razetime left 17:46 razetime joined 17:51 razetime left 17:53 razetime joined 18:06 razetime_ joined, razetime left 18:11 razetime_ left 18:12 razetime joined 18:36 razetime left 18:37 sivoais_ joined 18:42 sivoais left 21:36 lizmat_ left, lizmat joined 22:31 deoac joined