🦋 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. |
|||
tbrowder | good idea, thnx! | 00:24 | |
00:25
jpn joined
00:31
jpn left
00:53
jpn joined
00:57
jpn left
01:07
wayland76 left,
wayland76 joined
01:10
derpydoo joined
01:18
hulk joined
01:19
kylese left
01:23
jpn joined
01:28
jpn left
01:32
guifa left
01:34
guifa joined
02:15
hulk left,
kylese joined
02:17
jpn joined
02:21
guifa left,
jpn left
02:37
guifa joined
02:41
wayland76 left,
wayland76 joined
|
|||
guifa | hmmmm | 02:58 | |
m: class Foo { has $*bar } | 02:59 | ||
camelia | ( no output ) | ||
guifa | m: sub bar { say $*x }; class Foo { has $*x = 5; method hmm { bar } }; Foo.new.hmm | 03:00 | |
camelia | Dynamic variable $*x not found in sub bar at <tmp> line 1 in method hmm at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
03:44
wayland76 left,
wayland76 joined
03:45
wayland76 left,
wayland76 joined,
wayland76 left,
wayland joined
03:46
wayland left
03:47
wayland joined
03:49
wayland left,
wayland joined
03:52
wayland left
03:53
wayland joined
03:57
wayland left,
wayland joined
04:05
jpn joined
04:08
guifa left,
wayland left,
wayland joined
04:10
jpn left
04:17
wayland left,
wayland joined
04:24
wayland left,
wayland joined
04:27
wayland left,
wayland76 joined
04:30
kylese left
04:33
kylese joined
04:35
wayland76 left,
wayland76 joined
|
|||
wayland76 | Hi all! I'm making actions for a Slang, and I've copy-pasted the method infixish into my Slang, but when I try to run the code, it says "Undeclared name: Nodify". | 04:47 | |
The Nodify sub is at github.com/rakudo/rakudo/blob/bff2...ns.nqp#L31 and the infixish method is at github.com/rakudo/rakudo/blob/bff2....nqp#L1783 | 04:48 | ||
Is this happening because Nodify is a sub, not a method? | 04:49 | ||
I think I solved it. I created a sub Nodify that just called Raku::Actions.Nodify(@todo); | 04:51 | ||
04:51
wayland76 left
04:52
wayland76 joined
05:01
jpn joined
|
|||
wayland76 | In my Slang, I added: method TOP(*@_, *%_) { say "Starting Slang"; parent::TOP(@_, %_); } | 05:02 | |
Should that print out "Starting Slang" when it starts using the slang? | 05:03 | ||
05:05
wayland76 left,
wayland76 joined
05:06
jpn left
05:14
Aedil joined
|
|||
wayland76 | I think I found the problem; don't put the following in your slang: unit module Slang::BlockOperators; | 05:18 | |
OK, new error: method Perl6::Grammar+{Slang::BlockOperators::Grammar}.new-cursor not found | 05:26 | ||
I copy-pasted github.com/rakudo/rakudo/blob/bff2....nqp#L1944 and it can't find the method (the actual method is at github.com/rakudo/rakudo/blob/bff2...ar.nqp#L94 ). | 05:27 | ||
I'm not inheriting directly from the existing grammars, but using Slangify instead. Do I need to be inheriting from the grammars for this kind of thing to work? | 05:28 | ||
05:30
kylese left
|
|||
wayland76 | Nope, even when I inherit from RakuAST::Grammar, I still get the same error. | 05:30 | |
05:31
kylese joined
06:07
wayland76 left
06:08
wayland76 joined
06:11
wayland76 left,
wayland76 joined
06:13
wayland76 left
06:14
wayland76 joined
06:17
jpn joined
06:22
jpn left
06:34
stanrifkin joined
|
|||
librasteve | guifa: in your request for flatten(:levels), I think this was requested added in June 2024 via this PR github.com/rakudo/rakudo/pull/5594 | 06:59 | |
tellable6 | librasteve, I'll pass your message to guifa | ||
07:01
jpn joined
07:06
jpn left
|
|||
wayland76 | OK, so the new-cursor method is in the Raku::Common role, but if I say "does Raku::Common", it says "Invalid typename Raku::Common" | 07:13 | |
07:19
Sgeo left
|
|||
wayland76 | So I guess my question is, "Does anyone know how I can add 'does Raku::Common' to my grammar without that error? | 07:23 | |
librasteve | wayland76: sorry I don’t know slang stuff | 07:25 | |
wayland76 | librasteve: No worries :) . That's why I'm also writing the Slang doco :p | 07:26 | |
(because I don't know it either) | |||
librasteve | 👍 | ||
wayland76 | Also, I have a lurking suspicion that what I'm trying to do is particularly difficult, because I'm having to override EXPR, because, well, the comment above the EXPR rule (in the Rakudo source) says: The EXPR method implements an operator precedence parsing algorithm. One needs a stack for that and there's not a neat way to express it within the rule language. | 07:36 | |
So that method is over 150 lines of code. | |||
I have a lurking feeling that the solution is going to be something like being able to reach into a namespace and pull out the role I want to inherit from, but I don't know how. | 07:37 | ||
If it the solution ends up using $LANG.slang_grammar('MAIN') and maybe a .^WHAT I won't be surprised. | 07:41 | ||
lizmat | fwiw, EXPR is a beast :-) | 07:53 | |
07:58
yewscion joined,
yewscion_ left
08:02
jpn joined
08:59
wayland76 left,
wayland76 joined
|
|||
wayland76 | m: say $*LANG.^roles_to_compose($*LANG); | 08:59 | |
camelia | Too many positionals passed; expected 1 or 2 arguments but got 3 in block <unit> at <tmp> line 1 |
||
wayland76 | It segfaulted on mine. | 09:00 | |
m: say $*LANG.^roles_to_compose(); | |||
camelia | () | ||
lizmat | m: say $*LANG.HOW.roles_to_compose($*LANG); # did you mean this? | ||
camelia | () | ||
wayland76 | Good question. | 09:07 | |
librasteve | lizmat: I am wondering if the flat(:levels) PR (link above) made it to production - why? | 09:08 | |
m: say ($((1,2),(3,4)),(5,6)).flat; | 09:09 | ||
evalable6 | (((1 2) (3 4)) 5 6) | ||
Raku eval | (((1 2) (3 4)) 5 6) | ||
wayland76 | If I run that code directly, I get no output, but if I include it in my script, I get say $*LANG.HOW.roles_to_compose($*LANG); | 09:10 | |
librasteve | m: say ($((1,2),(3,4)),(5,6)).flat(:hammer); | ||
Raku eval | (((1 2) (3 4)) 5 6) | ||
evalable6 | (1 2 3 4 5 6) | ||
wayland76 | Anyway, if I could figure out how to add "does Raku::Common" to my class, I wouldn't be playing around with this :) | ||
librasteve | hmmm I gets (1 2 3 4 5 6) result of the hammer version on my local machine | ||
but I am struggling to get levels to do my bidding - seems like flat(:levels(1)) just ignores the named arg | 09:11 | ||
09:12
Aedil left
|
|||
oh, and hammer / levels do not seem to have made it to the doc ... I am happy to take a stab at a doc PR, but obviously would need examples to work first! | 09:12 | ||
09:14
lichtkind joined
09:16
lizmat left,
lizmat_ joined
09:17
lizmat_ left,
lizmat joined
09:41
jpn left
09:45
jpn joined
|
|||
grondilu | japhb: Kitty graphics protocol | 09:56 | |
_elcaro_ | Besides levels, which I'm only hearing about now... You can also control level with zen slice syntax perl [0] > my @a = [1, [2]], [[[3, [4]]], [[5, [6, 7]]]] [[1 [2]] [[3 [4]] [5 [6 7]]]] [1] > @a[*;*] (1 [2] [3 [4]] [5 [6 7]]) [2] > @a[*;*;*] (1 2 3 [4] 5 [6 7]) [3] > @a[*;*;*;*] (1 2 3 4 5 6 7) | 10:02 | |
10:15
stanrifkin left
|
|||
grondilu | m: class Foo { method WHICH { "FOO!" } }; class { method AT-KEY($x) { $x.lc with $x } }.new{Foo};' | 10:20 | |
camelia | ===SORRY!=== Error while compiling <tmp> Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1) at <tmp>:1 ------> T-KEY($x) { $x.lc with $x } }.new{Foo};'<HERE><EOL> expecting any of: … |
||
grondilu | m: class Foo { method WHICH { "FOO!" } }; class { method AT-KEY($x) { $x.lc with $x } }.new{Foo}; | ||
camelia | ( no output ) | ||
grondilu | I kind of expected foo! | ||
as I thought maybe AT-KEY would invoke WHICH | 10:21 | ||
though I suppose if it's named "AT-KEY" then it expects to get a key as paremeter, so WHICH is assumed to have already been invoked perhaps | 10:22 | ||
wayland76 | After doing some more looking around, is there a way I can inherit from Raku::Grammar? | 10:28 | |
lizmat | wayland76: is Raku::Grammar ? | 10:29 | |
ah, meh | |||
wayland76 | lizmat: 'Slang::BlockOperators::Grammar' cannot inherit from 'Raku::Grammar' because it is unknown. | ||
lizmat | yeah... :-( | 10:30 | |
wayland76 | I do have use experimental :rakuast | ||
lizmat | that just exposes the RakuAST:: classes | ||
wayland76 | Is there some other "use" I can add, or do something to cross a namespace or something? | ||
(regarding RakuAST:: classes) Right. That makes sense | 10:31 | ||
lizmat | use nqp; my constant G = nqp::gethllsym('Raku', 'Grammar'); | 10:33 | |
grammar A is G { } | |||
that is a temp workaround | |||
wayland76 | Haha, well, I'd never have come up with that :) | 10:34 | |
I'll try it. Thanks! | |||
lizmat | wayland76: actually | 10:37 | |
my constant G = $*LANG.grammar.WHAT; | |||
could be more portable :-) | |||
wayland76 | OK, sounds good, and I was kind of close earlier then :) | ||
m: my constant G = $*LANG.grammar.WHAT; grammar A is G { } | 10:41 | ||
camelia | ===SORRY!=== Cannot find method 'method_order' on object of type NQPClassHOW |
||
wayland76 | m: use nqp; my constant G = nqp::gethllsym('Raku', 'Grammar'); grammar A is G { } | ||
camelia | ===SORRY!=== Cannot find method 'method_order' on object of type NQPClassHOW |
||
wayland76 | They look great, but neither of them actually works, unfortunately. | 10:43 | |
If I declare it as "my role" instead of "grammar", it works better, but still self.new-cursor() doesn't work. | 10:49 | ||
I tried using the gethllsym one on Raku::Common as well, with the same result. | 10:53 | ||
lizmat | wayland76: I was wondering, why do you want to inherit from Raku::Grammar? | ||
wayland76 | Well, I'm trying to make a modified version of EXPR, and it's doing things like calling new-cursor. | 10:54 | |
That is, self.new-cursor (which is defined in Raku::Common) | |||
lizmat | why not use Slangify then? | ||
wayland76 | Oh, I'm using Slangify as well. | 10:55 | |
I have a lurking suspicion that, with Slangify, I can call anything that's part of the raku grammar, but not things in Raku::Common like .new-cursor | 10:56 | ||
If that's a bug in Slangify, I'm happy to put in a PR for a test on the Slangify module. | |||
lizmat | but... Raku::Common is done by Raku::Grammar | 11:00 | |
grammar Raku::Grammar is HLL::Grammar does Raku::Common | |||
so all its functionality should already be inside Raku::Grammar ? | |||
wayland76 | Yeah, one would think so, but that doesn't explain why I can't call .new-cursor. My current theory is that when the Slang grammar gets mixed in, maybe calls to the roles that are done aren't happening for some reason. | 11:04 | |
antononcube | @librasteve The option hammer was proclaimed in one of lizmat’s posts. | 11:09 | |
(Probably an advent one.) | |||
Agh, to clarify -- the named argument “hammer” of え`\flat. | 11:10 | ||
lizmat | raku-advent.blog/2024/12/25/day-25...24-review/ | ||
11:13
brone joined
11:14
LainIwakura joined
11:20
LainIwakura left,
brone left
11:23
bro34 joined,
bro34 left
|
|||
wayland76 | Hi lizmat. I've made you a test for Slangify that fails with the same error I'm getting. github.com/lizmat/Slangify/pull/1 | 11:25 | |
librasteve | the mystery deepens - seems that github.com/rakudo/rakudo/pull/5594 (with both hammer and levels) was merged to main Jun 2, 2024, yet levels does not seem to have survived - or maybe I misunderstand what levels does | 11:28 | |
lizmat | I guess the test needs an BEGIN %*ENV<RAKUDO_RAKUAST> = 1 in it? | 11:30 | |
CI says: Method Perl6::Grammar+{Piersing}+{RakuCommonTest}.new-cursor not found | |||
11:31
broner joined
|
|||
librasteve | (((1,2),(3,4)),(5,6)).flat(:levels(1)) expected ((1,2),(3,4),(5,6)) [or is that :levels(0)?] got (1 2 3 4 5 6) | 11:33 | |
wayland76 | Same error if I add that after the "plan 1", and before the lives-ok. | ||
(but yes, that's the error I get) | 11:34 | ||
11:34
jpn left
|
|||
lizmat | wayland76: with Perl6::Grammar in the error message, not Raku::Grammar ? | 11:38 | |
wayland76 | Yes, exactly that. | 11:40 | |
Does that mean that it's using the old grammar? | |||
lizmat | yes | 11:41 | |
11:41
LainIwakura joined
11:43
derpydoo left
|
|||
wayland76 | Hmm. So I've changed the PR to be github.com/lizmat/Slangify/pull/1/files -- it's likely my mistake somewhere, but I was wondering, is there anything else I need to do to force it to use the new grammar? | 11:50 | |
11:55
broner62 joined,
LainIwakura71 joined,
LainIwakura left,
broner left
11:56
LainIwakura54 joined
11:58
LainIwakura54 left
12:00
LainIwakura71 left,
broner62 left
12:10
jpn joined
12:15
jpn left
12:18
guifa joined
12:26
wayland76 left,
wayland76 joined
12:27
wayland76 left,
wayland joined
12:28
wayland left,
wayland joined
|
|||
guifa is starting to dislike working with Sets lol | 12:37 | ||
tellable6 | 2025-04-18T06:59:21Z #raku <librasteve> guifa: in your request for flatten(:levels), I think this was requested added in June 2024 via this PR github.com/rakudo/rakudo/pull/5594 | ||
guifa | it gets old having to always right %set.keys.map or for %set.keys | 12:38 | |
I know it's because the others bags/mixes will have values other than pure truthiness attached but still it's an extra step | 12:39 | ||
lizmat | at one time I did make the iterator just produce the keys, but that was deemed too magic and a WAT | 12:40 | |
guifa | yeah -- I get it, it's sort of two different conflicting expectations | ||
but frustating when you're in a fully Set-based codebase ha | 12:41 | ||
12:44
wayland left,
wayland76 joined
|
|||
lizmat | guifa: you are aware of the .set / .unset methods on SetHashes ? | 12:46 | |
guifa | yeah | 12:47 | |
it's mainly for iteration that it's annoying, especially cause I have a few places in the current code I'm doing where I have a | |||
if %set == 1 { push %set.keys.head } | 12:48 | ||
and that keys.head is just.... le sigh | |||
lizmat | m: dd Set.new(1).head.key | 12:55 | |
camelia | 1 | ||
guifa | golfing one char lol | 12:58 | |
but it's a tiny win I guess :-) | |||
lizmat | well, it doesn't look like .head() is optimized for QuantHashes | 12:59 | |
m: dd Set.new(1).iterator.pull-one | |||
camelia | 1 => Bool::True | ||
lizmat | m: dd Set.new(1).iterator.pull-one.key | ||
camelia | 1 | ||
lizmat | it should be basically that | ||
13:08
guifa left
13:30
jpn joined
13:35
jpn left
14:01
jpn joined
14:09
Sgeo joined
14:15
apac joined
14:23
Aedil joined
14:28
wayland76 left,
wayland joined
14:29
wayland left,
wayland joined
14:30
wayland left,
wayland joined
14:32
wayland left,
wayland joined
14:36
wayland left
14:37
wayland joined
14:40
wayland left
14:41
wayland76 joined
14:48
abraxxa-home joined
14:54
wayland76 left,
wayland76 joined,
jpn left,
wayland76 left
14:55
wayland76 joined
15:00
wayland76 left,
wayland76 joined
15:09
wayland76 left,
wayland76 joined,
wayland76 left
15:10
wayland76 joined
15:15
wayland76 left
15:16
wayland76 joined
15:24
wayland76 left
15:25
wayland76 joined
15:31
apac left,
wayland76 left
15:32
wayland76 joined
15:43
wayland76 left,
wayland76 joined
15:52
wayland76 left,
wayland76 joined
15:59
wayland76 left
16:00
wayland76 joined
16:03
wayland76 left,
wayland76 joined
16:14
wayland76 left,
wayland76 joined
16:22
abraxxa-home left,
wayland76 left,
wayland76 joined
16:28
jpn joined
16:32
jpn left
16:34
wayland76 left
16:35
wayland76 joined
16:56
wayland76 left,
wayland76 joined
16:57
jpn joined
16:59
apac joined
17:03
jpn left
17:11
wayland76 left,
wayland76 joined,
wayland76 left,
wayland joined
17:23
jpn joined
17:51
apac left
|
|||
SmokeMachine | weekly: dev.to/fco/introducing-mcp-a-proto...ntial-19gp | 19:01 | |
notable6 | SmokeMachine, Noted! (weekly) | ||
SmokeMachine | if anyone could gimme opinions about this (dev.to/fco/introducing-mcp-a-proto...ial-19gp), I would be very thankful... | 19:02 | |
This is just an idea I’m implementing… I’m only at the beginning… but I think that can be interesting and can bring some interest to Raku… MCP seems to be in the hype and seems to be very useful… would anyone like to help on that? | 19:08 | ||
19:15
apac joined
19:40
jpn left
19:42
jpn joined
19:47
jpn left
19:59
Aedil left
|
|||
SmokeMachine | Anyone? | 20:04 | |
20:14
jpn joined
20:20
jpn left
20:46
jpn joined
|
|||
antononcube | 🤔 | 21:11 | |
SmokeMachine | antononcube: don’t you like it? | 21:20 | |
21:29
apac left
|
|||
wayland | lizmat: I figured it out; I had to set the environment variable RAKUDO_RAKUAST externally or it just wouldn't work at all; putting it in BEGIN didn't seem to be enough. | 21:32 | |
lizmat | ah, duh :-) | 21:37 | |
yeah, the grammar is already selected then :-( | 21:38 | ||
my cold appears to have taken quite a few IQ points from me :-( | |||
wayland | That's no good (that you have a cold). I get that with colds too; I lose sight of the bigger picture. | 21:39 | |
lizmat | yeah, it sucks: I thought yesterday was the worst, but in the end today was :-( | 21:41 | |
thought I was recovered enough to go out and cycle 20km :-( | 21:42 | ||
21:54
apac joined
21:55
lichtkind left
|
|||
wayland | Ouch, yeah, that can do it. | 21:55 | |
21:56
guifa joined
|
|||
wayland | Anyone know what's going on with the :dba() things in the grammar? I'm getting: Unrecognized regex modifier :dba | 21:56 | |
lizmat | it's supposed to be meta info, dba == doing business as | 22:01 | |
afk& | 22:08 | ||
22:18
jpn left
|
|||
wayland | Right (thanks). Is there something else I need to include/use that would fix that error? | 22:26 | |
22:34
jpn joined
22:37
apac left
22:40
jpn left
23:27
derpydoo joined
23:49
stanrifkin joined
23:52
jpn joined
23:56
jpn left
|