🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
Geth doc/master: 5 commits pushed by Coke++ 00:09
doc: dd20c71e38 | Coke++ | 2 files
fix typo
00:23
rypervenche If I want to simply rename keywords, terms, etc. in a slang, should I be copying the tokens/rules verbatim from Grammar.nqp and then making changes to them? Or is a smaller bit a code OK to use? 01:24
I've seen that slangs like Slang::Mosdef don't copy the grammar's rules exactly the same. I'm not sure if that's because the grammar is changed, it's not necessary, or it just happens to be ok in this instance. 01:26
I should probably ask this in the morning :P
codesections I hope you get an answer – I've been curious about the same thing. And the (vaguely) related question of how to write a slang that *doesn't* edit an existing grammar, but starts from scratch instead 02:29
rypervenche So far I've been pretty successful with lower level things by copying the entire token/rule and then adding a | to get the custom term that I want. 02:51
Xliff Very weird results. Can someone tell me why this doesn't work? 04:45
repl.it/@Xliff/VictoriousUtilizedT...#main.raku
Xliff ^^ jnthn timotimo vrurg 04:46
rindolf Xliff: strcat(%c) - percent 04:50
Xliff Rindolf: Ah. Actually making changes, still. Try now. 04:51
moritz [Coke]: yes, autounfudge was my doing, originally 04:52
rindolf Xliff: ah, why do you wish to call strcat()? it is insecure and inefficient: www.joelonsoftware.com/2001/12/11/...to-basics/ 04:56
Xliff Because it is simple and it should work.
rindolf: What I'm really trying to do - determine if I can use literals in nativecall defs. 04:57
The answer looks like a "yes" for the first call. 04:58
rindolf Xliff: i doubt it
Xliff The subsequent results were surprising.
OK, that's the fixed use-case, now. 04:59
It should work. It doesn't. Why?
Even if I replace 'cat' with Str, the results are still the same.
timotimo Xliff: my first thought is, again, to throw valgrind at it 08:37
which i'm doing right now
timotimo Xliff: i assume the final expected string is actually "Baracat", not "Barcat"? 08:40
frustratingly, turning jit off seems to make it work? 08:41
but i would assume it has something to do with malloc and free being called in whatever order with whatever arguments 08:42
timotimo anyway, it's doing dirty things with memory in terms of use-after-free 08:45
Xliff: ^
codesections Is there a way to "disassemble" or otherwise view the contents of a .precomp file in a human-readable way? 11:17
fluca1978 I'm sorry I've read somewhere, but I'm not finding it anymore, why is ~~ evaluated on the right side? a ~~b is evaluated as b.ACCEPTS( a ) 11:30
moritz fluca1978: there are two reasons for that 11:50
the first is that a symmetrical smartmatching was tried first, and people didn't like how it behaved, at all
second reason: that's how people think, at least in English. "Is $thing an integer"? becomes $thing ~~ Int 11:51
fluca1978 thanks moritz, probably year of java raped my mind: a.equals( b ) 11:52
moritz fluca1978: then I wish a speedy recovery :D 11:53
fluca1978 thanks moritz 11:54
codesections I realize the user already left the channel, but I really hope phrases like "$thing raped my mind" don't become common here. It's much less inclusive/friendly than how I think of Raku and our community 11:56
lizmat codesections++ 11:59
moritz codesections: agreed; it rubbed me the wrong way, but I couldn't really articulate why 12:02
timotimo codesections: after you toss out the first bytes from a precomp file, "moar --dump blah.moar" will give you bytecode 12:03
lizmat timotimo: which first bytes ? 12:04
and why do we need to toss ourselves ?
timotimo it's got the dependency information in it 12:04
only need to cut stuff until the third \n, or i guess until you find \nMOARVM 12:06
i agree that moar --dump should perhaps learn to skip these bytes by itself
codesections timotimo: thanks, exactly what I wanted 12:12
ufobat oi :D 12:16
cpan-raku New module released to CPAN! XML::Actions (0.4.6.2) by 03MARTIMM 12:55
kawaii Hello, hoping there might be someone else here with Redis experience, and knowledge of sets. I'm working on a wordfilter bot, and want to use Redis as a kind of hot-storage for the wordlist. www.irccloud.com/pastebin/66EZY9Ok/ 14:00
But it seems like no matter what I do, the data becomes a flat list. 14:01
Redis certainly allows set values with spaces in, so I wonder if it's something to do with the Redis::Async module and how it sends the data. 14:02
codesections I know at least a bit about Redis and Raku sets, though I've not yet used Redis with Raku. Where is the $redis variable in the code you pasted from?
Redis::Async? 14:03
kawaii codesections: yep, it's simply `my $redis = Redis::Async.new('127.0.0.1:6379');`
Altai-man kawaii, if it's Redis::Async, you can create an issue, it seems like an unmarshalling "bug" (?). The author is usually pretty responsive. 14:04
kawaii Altai-man: I'll do so, just wanted to make sure I wasn't missing something obvious :) 14:06
Altai-man kawaii, well, this seems like a module-specific issue, it's just that method returns something X and not Y. You can convert that, of course, but this will kinda decrease performance (as in: more things to do - slower). 14:07
codesections interesting. I wasn't familiar with eredis, and it doesn't seem to be in many repos. Interesting choice to build on that instead of upstream redis 14:18
codesections ... and building eredis from source requires more time than I'm willing to invest in this right now. Sorry I can't be more help :( 14:21
kawaii codesections: no problem, I raised an issue, and yes it's a little tricky to get the module working compared to most others :P 14:22
Grinnz hiredis is the usual lib to work with 14:30
never heard of eredis
codesections Yeah, I hadn't either, which is why I thought it was interesting. 14:31
Grinnz it does look like it's either quoting your command incorrectly or interpreting the results incorrectly
because you're right, values can contain spaces as well as any other byte 14:32
codesections On the other hand, I *have* rolled my own Redis client with just the functionality I needed before, which is almost shockingly easy
Grinnz yes, the protocol is quite simple
Geth ¦ doc: codesections self-assigned Add detailsabout compile-time phasers github.com/Raku/doc/issues/3591 14:36
kawaii codesections: somewhat figured it out, if I send $badwords.keys instead of just $badwords it stores it correctly as a set, instead of just storing the whole thing as a string :) 14:50
codesections m: my $s = SetHash[Str].new("peach tea","banana","watermelon","apple"); say $s.keys.WHAT; say $s.keys.map({.WHAT}) 15:03
camelia (Seq)
((Str) (Str) (Str) (Str))
codesections kawaii: that seems pretty odd to me -- $badwords.keys is a Seq of strings. It's... odd API design to need to send a Seq of Str to get a Set, and not let you send a Set 15:05
kawaii codesections: yeah seems odd, but what can I say, oh well :) github.com/CurtTilmes/perl6-eredis/issues/4 15:14
tbrowder .tell jjmerelo i still can't see any update to the docs from 2+ weeks ago 15:51
tellable6 tbrowder, I'll pass your message to JJMerelo
VZ m: my token t { Init '(' ~ ')' (\S+) }; my regex r { Init '(' ~ ')' (\S+) }; my $str = 'Init(1)'; say &t ~~ $str; say &r ~~ $str; 16:52
camelia Regex object coerced to string (please use .gist or .raku to do that)
False
False
in block <unit> at <tmp> line 1
Regex object coerced to string (please use .gist or .raku to do that)
in block <unit> at <tmp> line 1
VZ m: my token t { Init '(' ~ ')' (\S+) }; my regex r { Init '(' ~ ')' (\S+) }; my $str = 'Init(1)'; say $str ~~ $t; say $str ~~ &r;
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$t' is not declared. Did you mean '&t'?
at <tmp>:1
------> 3S+) }; my $str = 'Init(1)'; say $str ~~ 7⏏5$t; say $str ~~ &r;
VZ m: my token t { Init '(' ~ ')' (\S+) }; my regex r { Init '(' ~ ')' (\S+) }; my $str = 'Init(1)'; say $str ~~ &t; say $str ~~ &r;
camelia Nil
「Init(1)」
0 => 「1」
VZ hi, could somebody please explain why "~" doesn't seem to work inside tokens, but only inside regexes? I don't see how is it related to :sigspace... 16:53
rypervenche So I've been working on a Slang to allow other words to be used in Raku for things like sub, method, class, etc. I was curious if it's possible to add another word to call "say" as both a sub and method. 17:42
What I'm currently working on: gitlab.com/rypervenche/slang-chine.../tree/test
CIAvash VZ: `\S+` is eating `)`, because token doesn't backtrack. see docs.raku.org/language/regexes#Ratchet 17:45
VZ @CIAvash thanks, I thought `~` was somehow smart enough to prevent this from happening... is there some more idiomatic way of doing this than using `(<[\N] - [)]>+)` or something like that? 18:24
CIAvash VZ: not sure, but you can make it non-greedy: `\S+?` 18:27
VZ yes, I guess this is the best thing to do, just in case there are nested parenthesis there -- thanks again! 18:28
CIAvash yw 18:31
[Coke] codesections++ 18:37
codesections hm? 18:38
[Coke] deep in review
Xliff . 18:46
timotimo: So JIT is optimizing things in a way where memory is getting freed before output. 18:48
timotimo yeah, just good ol' timing- and side-effect-sensitive code :) 18:53
Xliff So what would be the best way to make it work? 18:55
timotimo use CArray instead of Str 19:08
or fiddle around with explicitly-managed? 19:09
VZ oops, actually testing the suggestion above, using `\S+?` doesn't work when there is more than one character inside the parenthesis 19:13
m: my token t { Init '(' ~ ')' (\S+?) }; say 'Init(12)' ~~ &t; 19:14
camelia Nil
codesections tbrowder: The other day, you were asking about uses of `zef nuke`. I just found myself in a situation where running `zef nuke site home` seemed like the best way out 19:17
rypervenche m: my regex t { Init '(' ~ ')' (\S+) }; say 'Init(12)' ~~ &t; 19:19
camelia 「Init(12)」
0 => 「12」
CIAvash VZ: then I think you should either go with the character class you wrote or use regex instead of token. Not sure there is another way. 19:34
VZ yes, I've ended up with 19:35
token non-paren { <[\N] - [)]>+ }
token init-option { Init '(' ~ ')' (<.non-paren>) }
VZ to finish with this, I think it might be useful to spell this out in docs.raku.org/language/regexes#Til...structures as it goes into some much more advanced stuff without mentioning this gotcha, which seems much more basic 19:37
tbrowder codesections: did that blow away your $HOME/.zef stash? 20:55
codesections Yep. 20:56
Which was the idea – I somehow messed up my upgrade from 2020.06→07 in a way that confused zef about which modules I had installed
tbrowder i had to do that manually in the early days of zef upon suggestions by ugexe and moritz
Altai-man codesections, how do you upgrade? 20:57
tbrowder situation has been much better since then. what do you think was the problem? a rogue module?
codesections Altai-man: I don't really have a system, which is probably the issue :D Do you have a recommendation? 20:58
tbrowder i really have enjoyed the rakudo-pkg for debian. painless 20:59
and (knock on wood) i have had no problems with it running on multiple debian hosts 21:00
codesections tbrowder: I think it was just user error. I started with Rakudo Star, then installed Raku 2020.06 from a binary, then installed 2020.07 from source – and the first couple of those were before I'd gotten serious Raku, so I probably wasn't as careful as I should have been
Maybe I'll try that out for 2020.08 21:01
tbrowder i used to always install from source. i suggest starting now and forget your old method. 21:02
codesections The only thing is, I *do* still want to have a source version around, so that I can hack on the compiler. But that _probably_ shouldn't be my main raku executable :D 21:04
tbrowder once it's working: sudo apt update: sudo apt upgrade...
(or aptitude or apt-get)
easy peasy
tbrowder i do the same thing. rakudo hacking is done in a local dir away from main sys 21:05
tbrowder if i started over i might use docker 21:06
Geth ¦ doc: coke self-unassigned Change from p6doc to rakudoc github.com/Raku/doc/issues/3203 21:25
¦ doc: coke self-assigned Pod::Cache isn't safe for concurrent access github.com/Raku/doc/issues/3466 21:26
codesections weekly: www.codesections.com/blog/raku-uni...mpilation/ 22:20
notable6 codesections, Noted! (weekly)
codesections ^^^^ Just made my first blog post about Raku – I'd welcome any thoughts/feedback/criticisms 22:21
lizmat reads 22:22
rypervenche Another dark solarized user :) 22:56
codesections rypervenche: ha, I've actually moved away from Solarized (and most syntax highlighting in general) for my personal code – these days I use Nordless, which barely even counts as a colorscheme emacsthemes.com/themes/nordless-theme.html 23:00
but I figure it's nice to have a bit more color than that in a blog post :)
rypervenche lizmat: Do you happen to know where I might look to be able to call a sub or method by another name in a slang? I've been able to figure out everything else except for things like "say" and ".new". It hasn't been as straight-forward. 23:06