š¦ 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:13
ACfromTX joined
00:55
gfldex left
00:57
gfldex joined
00:58
japhb left
01:00
japhb joined
01:06
japhb left,
gfldex left,
japhb joined,
gfldex joined
01:09
kylese left
01:10
kylese joined
01:13
japhb left
01:14
japhb joined
01:31
japhb left
01:33
japhb joined
01:49
eseyman left
02:01
eseyman joined
02:04
guifa left
02:15
kylese left,
kylese joined
02:18
guifa joined
02:40
Aedil joined
03:01
guifa left
03:45
kylese left
03:48
kylese joined
04:15
jmcgnh left,
jmcgnh_ joined
04:18
jmcgnh_ is now known as jmcgnh
05:52
Aedil left
05:58
Aedil joined
07:05
apac joined
07:14
apac left,
sjm_ joined
07:42
dakkar joined
07:47
sjm_ left,
sjm_ joined
07:49
dakkar left
07:51
Sgeo left
07:52
sjm_ left
07:53
sjm_ joined
08:05
dakkar joined
08:27
wayland joined,
dakkar left
08:40
dakkar joined
08:44
wayland76 joined,
wayland left
09:18
wayland joined
09:19
wayland76 left
09:37
dakkar left
09:48
human-blip left
09:50
human-blip joined
09:53
dakkar joined
09:56
hvxgr left
09:57
hvxgr joined
|
|||
tbrowder | Voldenet: ref Pod::TreeWalker, pls show a useful example of an āis builrā Listener and put it in a comment in my PR on Pod::TreeWalker | 10:32 | |
sorry, put it in the new issue i just opened there | 10:37 | ||
11:02
wayland76 joined
11:03
wayland left
|
|||
tbrowder | lizmat: my comment to you ref source-url got lost in the ether: i said something like i don't know why skaji didn't use the META ref, but it may have been in case the PR is for an other url | 11:11 | |
11:25
guifa joined
|
|||
Voldenet | tbrowder: readme has the example already: `Pod::TreeWalker.new( :listener($to-html) ).walk-pod($=pod);` | 11:43 | |
the difference was that listener was private | 11:45 | ||
when it was `is built` | 11:46 | ||
m: class X { has $.n is required; }; X.new(n=>42).n.say | |||
camelia | 42 | ||
Voldenet | m: class X { has $!n is required; }; X.new(n=>42).n.say | ||
camelia | The attribute '$!n' is required, but you did not provide a value for it. in block <unit> at <tmp> line 1 |
||
Voldenet | m: class X { has $!n is required is built; }; X.new(n=>42).n.say | ||
camelia | No such method 'n' for invocant of type 'X' in block <unit> at <tmp> line 1 |
||
Voldenet | m: class X { has $!n is required is built; }; X.new(n=>42).say | ||
camelia | X.new(n => 42) | ||
11:51
vasko left,
vasko joined
|
|||
Voldenet | it's such a tiny detail that it doesn't seem worth considering | 11:53 | |
tbrowder | Voldenet: ok, i can work with those. thnx | ||
maybe, but i can't see things as clearly and easlly as you, and so i like to show noobs as clearly as possible when possible | 11:55 | ||
and i do like to see *practical* examples. remember the purpose of the module is to extract pod data which is usually much more complex | 11:58 | ||
esp. when using it solely for documentation | 11:59 | ||
Pod::TreeWalker is the best thing i've found for doing that | 12:00 | ||
(stepping down from soap box...) | 12:01 | ||
grondilu | To which degree can I use type constraints in &MAIN ? I've tried with an enum defined in the same compunit and that works, but if it's imported from a module, it does not. | 12:50 | |
like: `enum coin <heads tail>; sub MAIN(coin $flip) {...}` works but not `use CoinFlips; sub MAIN(coin $flip) {...}` | 12:53 | ||
eg: `raku -e 'package CoinFlip { enum coin is export <heads tail> }; import CoinFlip; sub MAIN(coin :$flip) { say $flip }' --flip=heads` | 12:55 | ||
^that just prints the usage notice on my machine. | 12:56 | ||
12:58
guifa left
|
|||
grondilu | but this prints "heads" : `raku -e 'enum coin <heads tail>; sub MAIN(coin :$flip) { say $flip }' --flip=heads` | 13:08 | |
13:22
sjm_ left,
sjm_ joined
13:25
sjm_ left,
sjm_ joined
|
|||
Voldenet | docs don't say anything about enums from other packages not being usable | 13:38 | |
coranila | feels like the enum is installed to late for &MAIN to find it lexically..? | 13:45 | |
,s/to/too | 13:46 | ||
[Coke] | m: package CoinFlip { enum coin is export <heads tail> }; import CoinFlip; say tail.value | ||
camelia | 1 | ||
coranila | probably not quite right; the fact that &USAGE sees it correctly is a bit befuddling | ||
but dispatch logic doesn't see it or we're not allomorphing in time? | 13:47 | ||
m: package CoinFlip { enum coin is export <heads tails> }; import CoinFlip; BEGIN say heads.WHAT; | 13:48 | ||
evalable6 | (coin) | ||
Raku eval | (coin) | ||
coranila | m: package Flip { enum coin is export <heads tails>; }; import Flip; multi MAIN(:$a) { $a.WHAT.say }; multi MAIN(coin(Str) :$a) { say $a }; MAIN(a => 'heads' | 13:54 | |
evalable6 | (exit code 1) ===SORRY!=== Error while compilin⦠| ||
coranila, Full output: gist.github.com/82185ff9a904e7281a...c752a758a9 | |||
Raku eval | Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1) at /home/glot/main.raku:1 ------> (Str) :$a) { say $a }; MAIN(a => 'heads'ā<EOL> expecting any of: postfix | ||
coranila | hrng | ||
m: package Flip { enum coin is export <heads tails>; }; import Flip; multi MAIN(:$a) { $a.WHAT.say }; multi MAIN(coin(Str) :$a) { say $a }; MAIN(a => 'heads') | |||
Raku eval | (Str) (Any) | ||
evalable6 | (Str) (Any) |
||
coranila | yeah, that does seem like we don't notice we could promote the Str; behavior is the same with bare coin as parameter type instead of coercive from Str | 13:56 | |
gist.github.com/crnlskn/40e8601896...953bd7173a # as per the wild guess above | 14:19 | ||
not sure how to fix it though; conceptually I'd think we could defer type resolution, but how to implement that I don't know! | |||
timo | i'm sure there's something we have for that actually | 14:21 | |
we do have COERCE don't we? | 14:22 | ||
coranila | timo: the issue is when importing the enum vs declaring it in the same file | 14:23 | |
timo | oh! | ||
coranila | ,s/file/scope | ||
timo | yeah sorry i hadn't read backscroll yet | ||
coranila | all good, helps me make sure i did poke at the right thing :-) | ||
timo | sounds like a straight-up rakudobug | ||
coranila | grondilu++ found it.. :-) | 14:24 | |
i'll keep it in mind and file it this evening if no one else is more eager | 14:25 | ||
might also see if/how COERCE could help, but that's a bit in the future! | 14:26 | ||
14:47
Xliff joined
|
|||
Xliff | If I want to have a regex search for the keys in a hash, what is the best way to do that? | 14:48 | |
timo | you mean the regex should accept things that are keys in the given hash, not use a regex to go through the keys of a hash to find one or more matching keys? | 14:50 | |
Xliff | m: my %h = ( a => 1, b => 2, c => 3); say "cde" ~~ /%h/ | 14:51 | |
camelia | ===SORRY!=== Error while compiling <tmp> The use of hash variables in regexes is reserved at <tmp>:1 ------> => 1, b => 2, c => 3); say "cde" ~~ /%h<HERE>/ |
||
Xliff | m: my %h = ( a => 1, b => 2, c => 3); say "cde" ~~ /<%h>/ | 14:52 | |
camelia | Nil | ||
Xliff | m: my %h = ( a => 1, b => 2, c => 3); say "cde" ~~ /<%h.keys>/ | ||
camelia | ===SORRY!=== Error while compiling <tmp> Unable to parse expression in metachar:sym<assert>; couldn't find final '>' (corresponding starter was at line 1) at <tmp>:1 ------> => 1, b => 2, c => 3); say "cde" ~~ /<%h<HERE>.keys>/ |
||
Xliff | m: my %h = ( a => 1, b => 2, c => 3); say "cde" ~~ /@( %h.keys )/ | ||
camelia | ļ½¢cļ½£ | ||
timo | m: my %foo = <a b c d e f g h>; say "hello there how are you" ~~ m:ex/ @(%foo.keys) / | ||
camelia | (ļ½¢eļ½£ ļ½¢eļ½£ ļ½¢eļ½£ ļ½¢aļ½£ ļ½¢eļ½£) | ||
lizmat | Xliff: perhaps raku.land/zef:lizmat/Map::Match ? | 15:01 | |
Xliff | lizmat: Nah. I'm keeping it simple. | 15:07 | |
timo++ (and lizmat++) | |||
librasteve | holy cow - that Map::Match is a mind bender | 15:10 | |
;-) | |||
antononcube | @librasteve Well, lizmat has been "pushing" "Map::Match" as a solution before. I still have to think how to be used for emojis retrieval... | 15:19 | |
lizmat | antononcube what do you want to use as search key for an emoji such as š ? | 15:22 | |
antononcube | "wind direction check" | 15:29 | |
lizmat | hmmm... so "wind direction check" => "š" in a hash ? | 15:35 | |
15:35
discord-raku-bot left,
discord-raku-bot joined
|
|||
lizmat | antononcube so "wind direction check" => "š" in a hash ? | 15:35 | |
15:57
apac joined
16:20
Xliff left
|
|||
antononcube | @lizmat I was joking for the "wind direction." The use of "Map::Match" was suggested by you at some point when discussing the emojis package. | 16:33 | |
lizmat | I was just thinking along... trying to get to a solution | 16:35 | |
16:47
dakkar left
17:17
sjm_ left,
sjm_ joined
17:22
sjm__ joined,
sjm_ left
17:26
sjm_ joined
17:27
sjm__ left
18:01
abraxxa-home joined
18:09
apac left,
abraxxa-home left
18:10
abraxxa-home joined
18:12
abraxxa-home left
18:21
abraxxa-home joined
20:31
[Coke] left
20:33
apac joined,
skyesoss joined
20:36
skyesoss left
20:38
Aedil left
21:35
abraxxa-home left
21:59
Sgeo joined
22:10
apac left
22:27
[Coke] joined
|
|||
tbrowder | lizmat: cool! i see you did make Pod::TreeWalker "is required" yay | 22:32 | |
wayland76 | grondilu: Regarding MAIN, one of the things I'm working on in the background is an optional replacement for MAIN that's a bit more complex in some ways. The concept is that you run "<executable> <command> <object>" on the command line, and then in the code, you define a bunch of objects with methods, and the methods are exported as the commands. It may be a while though. | 22:38 | |
22:52
guifa joined
22:59
wayland76 left
23:10
japhb left
23:17
japhb joined
23:42
japhb left
23:43
japhb joined
|