š¦ 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. |
|||
00:03
[Coke]_ is now known as [Coke]
00:34
sena_kun left
|
|||
Voldenet | using class trait isn't that hard, but I have no idea how to export a sub into caller context | 00:41 | |
m: multi sub trait_mod:<is> (Mu:U $target, :$subbed!) { say $target.^name; }; class MyPage is subbed { }; | 00:42 | ||
camelia | MyPage | ||
Voldenet | m: my $subs; sub p {}; multi sub trait_mod:<is>(Mu:U $target, :$subbed!) { $subs{$target.^name.lc} = sub (*@a, *%h) { $target.new(|@a, |%h) }; }; class MyPage is subbed { }; say $subs<mypage>() | 00:52 | |
camelia | MyPage.new | ||
01:14
wbooze joined
01:20
wbooze left
01:22
kaskal- joined
01:23
kaskal left
02:18
rir left
02:44
kylese left,
kylese joined
02:52
yewscion joined
02:57
yewscion left
02:58
Aedil joined
03:06
kst left
|
|||
Geth | docker: 02696336f5 | AntonOks++ | 4 files Bump to 2025.02 [skip workflow] |
03:06 | |
03:15
kylese left,
kylese joined
03:40
yewscion joined
03:47
yewscion left
03:50
yewscion joined
03:52
JimmyZ joined
|
|||
.landyacht. | I've been fiddling with this for a while and I just cannot get anything to work | 03:52 | |
I was thinking something like GLOBAL::.ASSIGN-KEY(...), but maybe the order in which things happen isn't right for being able to use that in a trait_mod | 03:53 | ||
also tried adding it to the EXPORT::DEFAULT of the package being is subbed'd but that didn't pan out either | 03:55 | ||
this is probably easier with RakuAST? | 03:56 | ||
03:56
JimmyZ is now known as JimmyZ_
03:57
JimmyZ_ is now known as JimmyZ
03:58
yewscion left
04:08
JimmyZ left
|
|||
okay, using the actual Rakudo implemention of is export as a reference, there is a (naughty) way to do it | 04:15 | ||
unit module Subbed; multi trait_mod:<is>(Mu:U $class, :$subbed!) is export { my $nice-name = $class.^name.lc.subst('::', '-'); my @tags = < ALL DEFAULT >; Rakudo::Internals.EXPORT_SYMBOL("&$nice-name", @tags, sub (*@pos, *%named) { $class.new(|@pos, |%named); } ); } | 04:17 | ||
referenced: github.com/rakudo/rakudo/blob/f8b1...kumod#L278 | 04:19 | ||
cc @librasteve | 04:21 | ||
04:24
JimmyZ joined
04:29
avuserow left
04:34
Guest14 joined
04:37
JimmyZ is now known as JimmyZ__,
JimmyZ__ is now known as JimmyZ
04:49
JimmyZ is now known as JimmyZhuo
04:51
JimmyZhuo left,
JimmyZhuo joined
04:57
avuserow joined
05:43
JimmyZhuo left
06:03
MyNetAz left
06:12
Aedil left
06:16
Aedil joined
06:18
MyNetAz joined
|
|||
melezhik. | . | 06:57 | |
tellable6 | 2025-03-01T13:56:44Z #raku <tbrowder> melezhik you should audition for Saturday Night Live | ||
melezhik. | .tell librasteve: you may pick up sparky badge for Air if you wish , itās ready | 06:58 | |
tellable6 | melezhik., I'll pass your message to librasteve | ||
07:32
yewscion joined
07:36
yewscion left
08:45
JimmyZhuo joined
08:46
wbooze joined,
JimmyZhuo is now known as JimmyZ,
JimmyZ is now known as JimmyZhuo
08:51
wbooze left
09:05
Sgeo left
09:11
kylese left
09:13
dakkar joined
09:16
kylese joined
09:29
lizmat joined
09:43
sena_kun joined
09:54
jjido joined
10:15
jjido left
10:19
[Coke] left
10:26
jpn joined,
wbooze joined
10:46
[Coke] joined
|
|||
melezhik. | . | 10:48 | |
11:16
wbooze left
11:30
JimmyZhuo left,
Guest14 left
|
|||
How can I substitute line number N in multiline string in Raku ? | 11:55 | ||
m: my $a = āok\nhello\ndoneā; | 11:58 | ||
evalable6 | |||
Raku eval | |||
melezhik. | m: my $a = āok\nhello\ndoneā; my @a = $a.split(ā\nā); @a[1] = ābyeā; $a = @a.join(ā\nā); say $a; | 12:02 | |
evalable6 | ok bye done |
||
Raku eval | ok bye done | ||
tbrowder | Voldenet: thanks, that helps a bit, | 12:32 | |
rir: yep, but i can't for now see any practical use for :U in my world | 12:33 | ||
tellable6 | tbrowder, I'll pass your message to rir | ||
12:36
jjido joined
12:53
kaskal- left
12:57
kaskal joined
|
|||
Voldenet | now that I think of it, C# have recently introduced the nullable reference type, which is a bit like type smileys | 13:01 | |
in that case, `void X(F? f) {}` accepts both F? (nullable) and F (not nullable) | 13:02 | ||
but `void X(F f) {}` accepts only non-nullable version | |||
(it prints warnings) | 13:03 | ||
so I suppose seeing the use cases for C# reference nullability could be helpful in grasping what it's useful for | |||
however `sub x(F:U $f) {}` is something that doesn't appear in C# at all | 13:04 | ||
probably because there's no type object, because type info is passed through generic invokation parameters | 13:05 | ||
timo | yeah C# shares a single null value like many other languages do, right? | 13:35 | |
13:54
yewscion joined
13:58
yewscion left
14:03
yewscion joined
14:08
yewscion left
14:44
jpn left
14:45
jpn joined
|
|||
antononcube | weekly: rakuforprediction.wordpress.com/20...ns-graphs/ | 15:34 | |
notable6 | antononcube, Noted! (weekly) | ||
15:51
Aedil left
15:55
Aedil joined
|
|||
librasteve | Rog: soz - that 8 hours became 16 due to $day-job ;-( ... thanks indeed for your proposal I have tried it with my code and despite some messing with tag names had no luck ... do you think maybe I need ot have a use MONKEY-TYPING switch on maybe? am I missing something else? | 16:08 | |
tellable6 | 2025-03-06T06:58:31Z #raku <melezhik.> librasteve: you may pick up sparky badge for Air if you wish , itās ready | ||
librasteve | Melezhik - thanks! I will add to my todos when i get to test... | 16:09 | |
16:36
yewscion joined
16:41
yewscion left
16:52
yewscion joined,
Sgeo joined
16:57
yewscion left
|
|||
.landyacht. | I think youāll have to actually import the package containing the subbed class | 17:01 | |
I split my code into three files | 17:02 | ||
One with the subbed class as a unit class | |||
17:02
jpn left
|
|||
Another for the trait itself, and then a script to pull in the subbed class and use the constructor sub | 17:15 | ||
17:24
^Dan joined
17:30
jjido left
17:31
LainExperiments joined
17:33
yewscion joined
17:34
dakkar left
17:36
^Dan left
17:38
yewscion left
18:27
derpydoo joined
18:34
LainExperiments left
18:35
LainExperiments7 joined
18:36
LainExperiments joined
18:40
LainExperiments7 left,
LainExperiments4 joined
18:42
LainExperiments left
18:47
LainExperiments4 left
19:15
Aedil left
19:21
derpydoo left
19:50
yewscion joined
19:55
yewscion left
19:57
jrjsmrtn joined
20:09
yewscion joined
20:14
yewscion left
20:41
yewscion joined
20:42
jjido joined
20:45
yewscion left
21:10
yewscion joined
21:15
yewscion left,
SrainUser joined
|
|||
SrainUser | How can I match more than one end of line statements in my grammar? Code: | 21:18 | |
grammar statements { | |||
rule TOP { | |||
<statement>* | |||
} | |||
rule statement { | |||
"hello" $$ | |||
} | |||
} | |||
my Str $source = "hello\nhello"; | |||
say statements.parse($source) | |||
[Coke] | m: grammar statements { rule TOP { <statement>* }; token statement { 'hello' $$ \s* } }; my Str $source = "hello\nhello"; say statements.parse($source) | 21:30 | |
camelia | ļ½¢hello helloļ½£ statement => ļ½¢hello ļ½£ statement => ļ½¢helloļ½£ |
||
[Coke] | I think the rule's interaction with the \n was getting confused. | 21:31 | |
making it all explicit with the token was easier for me, anyway. | |||
(note that the newline is in the first capture there, we could tweak that so it isn't captured. | 21:34 | ||
SrainUser | So it matches when there could be whitespace after the end of line? | 21:41 | |
Like it doesn't recognize $$ | |||
How would I not capture newline? | 21:42 | ||
21:49
yewscion joined
21:50
wbooze joined
21:53
yewscion left
|
|||
[Coke] | m: grammar statements { rule TOP { <statement>* %% \s* }; token statement { 'hello' $$ } }; my Str $source = "hello\nhello"; say statements.parse($source) # should work | 21:54 | |
camelia | ļ½¢hello helloļ½£ statement => ļ½¢helloļ½£ statement => ļ½¢helloļ½£ |
||
21:54
SrainUser left
|
|||
[Coke] | I moved the whitespace check up into TOP and said the statements are separated by whitespace - there's more than one way to do it. | 21:56 | |
22:05
yewscion joined
22:10
yewscion left,
SrainUser joined
22:11
yewscion joined
22:15
yewscion_ joined
22:17
yewscion left
22:18
yewscion_ left
|
|||
SrainUser | Could you repeat that example again? My wifi went down. | 22:25 | |
22:34
jjido left
22:38
yewscion joined
|
|||
SrainUser | I was able to check the irc logs. Thanks Coke. | 22:42 | |
22:42
yewscion left
22:47
yewscion joined
22:50
wbooze left
22:51
yewscion left
|
|||
[Coke] | oh good. I just back and also replied in private chat before I saw this. ;) | 23:14 | |
*got | |||
itsrakanott | Hi guys. Has anybody experienced issue of rakudo not being able to find import modules on windows? It searches exactly where the module resides and still lets out an erroring trace. How is that even possible lol | 23:15 | |
ugexe | yes, when i was doing something wrong | 23:38 | |
regardless if you want some actual advice you'll want to post a golfed example of your issue, the command you are running, all of the output, and like a file listing of the path your modules are supposed to be | 23:39 | ||
also your version of rakudo would be useful to know in case it is the file length issue | |||
23:51
sena_kun left
|