🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku)
Set by lizmat on 23 May 2021.
lucs When I do 「▸ rakubrew available」, some versions are prefixed with 'D', what does it mean? 02:16
pony can you include regexes, rules, and tokens from one grammar into another? (to avoid having very large ones)? 07:01
e.g. include number grammar in calculator grammar in compiler grammar :) 07:03
japhb Inheritance works; grammars are classes 07:04
moon-child m: my token x { h }; grammar G { token TOP { <x> } }; grammar H { token TOP { <x> } }
camelia ( no output )
japhb And as moon-child points out, lexical scope works too. :-)
pony COOL 07:06
cool (sorry caps)
m: grammar A { TOP { 'a' } }; grammar B is A { TOP { <A::TOP> } }; say B.parse('a') 07:07
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
TOP used at line 1
pony m: grammar A { TOP { 'a' } }; grammar B is A { token TOP { <A::TOP> } }; say B.parse('a') 07:08
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
TOP used at line 1
pony m: grammar A { token TOP { 'a' } }; grammar B is A { token TOP { <A::TOP> } }; say B.parse('a')
camelia 「a」
A::TOP => 「a」
patrickb lucs: Re `rakubrew list-availiable`. The "D" marks versions for which a precompiled archive is available. This means you can use `rakubrew download` to set up such a version, which is an aweful lot faster than `rakubrew build`. I just noticed, that the docs over on rakubrew.org are stale in that respect. Will update this evening. 07:49
tellable6 2021-07-14T19:40:56Z #raku <melezhik> patrickb: just a thoughts ... ))
hey patrickb, you have a message: gist.github.com/0d7a53c265b37a86ad...49d4294a16
hey patrickb, you have a message: gist.github.com/001b4e7872d54f3131...e7ddec8acb
2021-07-14T19:47:46Z #raku <melezhik> patrickb: avoiding AND emperical constructions -> avoiding ANY emperical constructions
hey patrickb, you have a message: gist.github.com/e02f10f78b3a701e31...3b60dee1f9
patrickb lucs: Also, did you know you can do `rakubrew help list-available`? 07:58
Geth doc: mykhal++ created pull request #3915:
fix Python (dict key string) syntax
08:42
doc: ba3bbf749e | (Michal Bozon)++ (committed by Juan Julián Merelo Guervós) | doc/Language/py-nutshell.pod6
fix Python (dict key string) syntax

was wrong Python syntax, or, dict() definition in fact tried to use (non-existent) variables instead of string literals
08:58
linkable6 Link: docs.raku.org/language/py-nutshell
Xliff moon-child: Thanks for that 10:28
lucs patrickb: Ah, thanks for the 'D' explanation, and also for reminding me that command line help is available (I happened to be looking at the web page, and didn't think about doing a 'help'). 11:11
mykhal oh duck, raku makes you butter(fly) 12:19
mykhal would have more doc fixes, but doesn't want to cause Geth commit report flood 12:20
mykhal s/(\w+)\(\w+\)/($1)$2/ 12:39
Altreus it is quite a verbose report isn't it
mykhal Altreus: may be subjective, I'm here for few days. I mind more that I don't know yet why my regex is incorrect in raku, it's something with escaped \( 's 12:47
.. ok, missing additional () pair :/ sorry 12:48
MasterDuke mykhal: geth report floods are welcome, because that means things are getting better 12:55
Geth doc: mykhal++ created pull request #3916:
operator doc: (value, syntax) error fix
13:01
[Coke] weird. I have two scripts that use 'use lib '../foo'; use MY::MODULE' - one works, the second says No such method 'CALL-ME' for invocant of type 'Str' 13:40
... and it used to work. wtf.
[Coke] weird. rm -rf ../foo/.precomp - now it works. 13:42
(on windows, using git bash)
melezhik . 14:24
[Coke] -bash: .: filename argument required 14:26
[Coke] m: e.IO.IO 14:27
camelia ( no output )
[Coke] sensibly chuckles.
mykhal m: $*PERL.compiler 14:41
camelia ( no output )
Xliff Is there a write-up on how to dynamically create a class and add it to a compunit? 14:45
Is this possible in current Raku, or would this need RakuAST? 14:46
moritz what do you mean by "add it to a compunit"? 14:49
Xliff Wouldn' 14:50
Xliff I would want to have the dynamically created class become a part of the compunit it is defined in. 14:50
Or could I just assign that class to a constant, couldn't I?
moritz yes 14:51
Xliff moritz: So how do I go about creating a class type? 14:51
And then creating the constant that goes with it 14:52
moritz see docs.raku.org/type/Metamodel::ClassHOW if you want to create a class 14:53
call new_type to create the class
add_method to add methods
etc
in the end, call compose
Xliff OK. 14:54
moritz and assing it to a constant just constant MyClass = do { code that generates the class goes here }
and have the class be the last expression
or
Xliff Yes, but the constants are also created dynamically.
Which means their names are going to come from a string
And I want it to behave as if they were statically defined. 14:55
moritz then you probably need to add them to the symbol table
Xliff Which means no sigil.
moritz not with the "constant" declarator
Xliff Is there another way?
moritz why do you want another way?
Xliff Can I dynamically create a sigil-less identifier and package that with a compunit?
moritz ::{$name} = 42 14:56
Xliff So I want to dynamically create "myType" from data. And then use it in code like "my myType $a .= new"
moritz that's how I understood your question 14:57
Xliff OK. Thanks. I appreciate the advice. I just need that last piece, I think.
moritz the thing is, the code that wants to use myType needs to know myType at *its* compile time
so you could have at the top of the usage a "use TypeGenerator;"
and that uses and compiles TypeGenerator, which could dynamically generate the types 14:58
(the nesting of run time and compile time can be confusing at times)
Xliff Actually, I was hoping I could create these at BEGIN time, serialize them in .precomp, then use them like regular types at runtime.
moritz that might work as well 14:59
Xliff All of the data required to create these types exists at compile time.
I just don't want to have to break them down and create them by hand, if possible.
moritz caveat: all my meta model hacking days are years in the past, so stuff might have changed (but probably not for the worse :D) 15:00
Xliff Take this for example. I have this exemplar class as: "class DialogClassPart is repr<CStruct> is export { has XtPointer $.extension; }"
lucs patrickb: As documented, I placed in .zshrc the 「eval "$(/shome/lucs/rakubrew/bin/rakubrew init Zsh)"」 line, but unfortunately, .zshrc is not sourced when a shell is launched from a script, so in that case, the PATH is not adjusted and raku is not found. 15:01
Xliff However there are more distinct classes that look exactly the same, just with a different name.
So there's: GripClassPart, ListClassPart, MenuButtonClassPart, PannerClassPart, etc...
lucs patrickb: Any special reason that line wouldn't be better placed in .zshenv?
Xliff All with the same definition. 15:01
lucs (Appears to work when it's there.)
Xliff Is there a way I can create all of those classes from the first one via nqp or meta programming? 15:02
melezhik how can I refer to `#` in regexp by code? 15:04
moritz Xliff: I have too little up-to-date experience to tell
melezhik: I don't understand the question
melezhik I want to say `"# hello" ~~ /'#'/` but I can't use `#` in regexp literally 15:05
Xliff moritz: OK, fair enough. Still, your advice has been invaluable. Have any idea who else I should ask?
moritz m: say '# hello' ~~ /'#'/
camelia ( no output )
patrickb lucs: I'm not that familiar with zsh and when which of those files is sourced. rakubrew is fine with being initialized multiple times. So it doesn't hurt to put it in a script that is potentially sourced more than once.
moritz melezhik: the bot seems to be b0rked, /'#'/ seems to work just fine for me 15:06
melezhik I'd like to have an equivalent regexp detention without `#` sign
moritz \c[NUMBER SIGN] ?
\c[NUMBER SIGN] ? 15:07
melezhik yeah, something like that, thanks!
patrickb IIRC The docs now say to use .bashrc instead of .bash_profile for the same reason. (I think .bashrc is called on every new (sub)shell, while .bash_profile is called less often. Or something along those lines.)
lucs: So .zshenv is called more often than .zshrc? 15:08
lucs It's called when a script shells out, contrary to .zshrc. 15:12
patrickb lucs: Ah, so it might actually make sense to add it to both?
have to leave for a bit...
lucs patrickb: I believe having it only in .zshenv is sufficient (like perlbrew does), but I'm not sure how to test it adequately. 15:15
tellable6 lucs, I'll pass your message to patrickb
Xliff moritz: TMTOWTDI -- I used this to solve the use case I mentioned to you... 15:16
grep ClassPart Structs.pm6 | grep has | cut -d\ \-f2 | sort | uniq | raku -ne 'print "class { $*IN.lines[0].chomp } is repr<CStruct> is export \{\n has XtPointer \$.extension;\n\}\n\n"'
lucs patrickb: From my notes: gist.github.com/lucs/c321819d1cc12...a63b6cf0d0 15:30
patrickb lucs: OK. So .zshenv seems like the file to aim for. 15:32
tellable6 2021-07-15T15:15:35Z #raku <lucs> patrickb: I believe having it only in .zshenv is sufficient (like perlbrew does), but I'm not sure how to test it adequately.
lucs Yeah, pretty sure that's the ticket.
Geth rakubrew.org: 763db71315 | (Patrick Böker)++ | 2 files
Provide instructions for how to work around MacOS' security limitations

Fixes #34
16:21
rakubrew.org: b12b294f33 | (Patrick Böker)++ | Containerfile
Bump Raku to 2021.04
rakubrew.org: e9eda7412a | (Patrick Böker)++ | resources/homepage.md.tmpl
Add/update the documentation for `home` and `list-available`
patrickb vrurg: Can you confirm, that putting the rakubrew initialization in `.zshenv` makes more sense compared to the current `.zshrc`? 16:26
Geth App-Rakubrew: dc2b6b9bd2 | (Patrick Böker)++ | 2 files
By suggesting to add the hook to `.zshenv` instead of `.zshrc`.

It seems as `.zshenv` is available even in scripts, while
  `.zshrc` things are unavailable to scripts.
See web.archive.org/web/20210226033246...zshrc-etc/
16:38
Geth doc: bbb7c27854 | (Michal Bozon)++ (committed by Juan Julián Merelo Guervós) | doc/Language/operators.pod6
operator doc: (value, syntax) error fix
18:37
doc: 76e29aa76c | (Michal Bozon)++ (committed by Juan Julián Merelo Guervós) | doc/Language/operators.pod6
.. fixed excesive space
linkable6 Link: docs.raku.org/language/operators
mykhal one can wonder if infix methodop can be done, stackoverflow.com/q/68399295 19:05
Geth Raku-Steering-Council/main: d6e69053a3 | (Elizabeth Mattijsen)++ | README.md
Add current members to README
19:30
Raku-Steering-Council/main: c854b84113 | (Elizabeth Mattijsen)++ | README.md
Oops, fixed copy-pasto

Sorry, Daniel :-)
19:33
lucs Problem installing Inline::Perl5 : 22:31
gist.github.com/lucs/9fdbad93fcbc9...d62b5d5a17
[Coke] lucs: do you have perl5 installed? 22:34
lucs Yep
[Coke] if so: maybe it's too old. Or maybe you don't have the dev version installed if you installed it with a package.
lucs In the PATH
Um, I perlbrewed a 5.34.0.
[Coke] Did you: perlbrew install perl-stable -Duseshrplib ? 22:35
(ish)
lucs Installed with the -Duseshrplib, yes
[Coke] ok. That's all the help I have, sorry. :) 22:36
lucs Ok, thanks.
▸ $PERLBREW_ROOT/bin/perlbrew install perl-5.34.0 -Duseshrplib -Dusemultiplicity 22:37
And I installed a 2021.06 rakudo/moar. 22:41
(followed by a ▸ rakubrew build-zef ) 22:44