🦋 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. |
|||
kawaii | timotimo: works perfect, thank you <3 | 00:01 | |
timotimo | == will always convert its arguments to numeric | 00:02 | |
you will not want to do that to the message content, and also not to the regex :) | |||
00:09
markoong left
00:15
sena_kun joined
00:16
Altai-man_ left
00:17
xinming_ left
00:18
xinming_ joined
00:48
oddp left
01:13
aborazmeh joined,
aborazmeh left,
aborazmeh joined
01:20
telex left
01:22
telex joined
01:31
Kaiepi left
01:32
Kaiepi joined
01:33
guifa left,
dustinm` left,
guifa joined
01:36
dustinm` joined
|
|||
codesections | I know I can use `&say.file` to introspect on the file that declared a sub. I could have sworn there was a way to do the same for a Type, but now I can't find it in the docs | 01:41 | |
did I just make that up? | |||
Geth | ¦ problem-solving: vrurg assigned to jnthn Issue Allow overriding of compiler-handled operators github.com/Raku/problem-solving/issues/214 | 01:42 | |
vrurg | codesections: You certainly made that up. When a new type is created by the metamodel the information about the source file/line is not even passed into the constructor method. | 01:49 | |
codesections | vrung: Thanks. And the same goes for a method on a type? I can use `.file` on a standalone sub but not on a method? | 01:51 | |
er, vrurg:,sorry | |||
vrurg | codesections: a method is a Routine, as a sub is too. Both carry this information on them. | 01:53 | |
m: class Foo { method foo { } }; say Foo.^lookup("foo").file | 01:54 | ||
camelia | <tmp> | ||
vrurg | codesections: ^^^ | ||
cpan-raku | New module released to CPAN! App::AizuOnlineJudge (0.0.5) by 03TITSUKI | ||
codesections | Thanks! | 01:55 | |
vrurg | codesections: welcome! :) | ||
01:58
raku-bridge4 joined
02:08
e left,
Kaiepi left,
aborazmeh left,
sena_kun left,
dataangel left,
zacts left,
APic left,
molaf left,
cpan-raku left,
robinsmidsrod left,
webstrand left,
Guest91264 left,
marcusr left,
nicholatian left,
gordonfish left,
skyl4rk left,
jmcgnh left,
poga left,
orinthe left,
m0ltar_ left,
Noisytoot left,
kybr left,
vike left,
xinming_ left,
maggotbrain left,
ensamvarg left,
dogbert17 left,
broquaint left,
bdju left,
silug left,
nebuchadnezzar left,
stux|RC left,
krunen left,
sno left,
sivoais_ left,
lizmat left,
Voldenet left,
eseyman left,
lnx left,
mst left,
a3f left,
codesections left,
cooper left,
leah2 left,
SmokeMachine left,
jhill left,
fridim left,
sftp left,
ChoppedBacon left,
mrsolo left,
BinGOs left,
ecocode left,
zostay left,
Roamer`_ left,
simcop2387 left,
xq left,
esh left,
rba left,
El_Che left,
veesh left,
Manifest0 left,
Maylay left,
gabiruh left,
Benett left,
tinita left,
cgfbee left,
xi left,
benaiah left,
timotimo left,
raku-bridge left,
dpk left,
tomaw left,
renormalist left,
Mithaldu left,
nine left,
jdv79 left,
a3r0 left,
m_athias left,
samebchase left,
ambs left,
stux|RC-only left,
releasable6 left,
quotable6 left,
sourceable6 left,
benchable6 left,
coverable6 left,
shareable6 left,
sergot_ left,
dotdotdot left,
tony-o left,
pierrot left,
karupanerura left,
shadowpaste left,
cibs left,
tailgate left,
perryprog left,
tardisx left,
CIAvash left,
Nasrudin left,
dudz left,
xkr47 left,
smash left,
k-man left,
epony left,
Zero_Dogg left,
aindilis left,
gugod left,
HarmtH left,
hvxgr left,
cj left,
elcaro left,
tobs left,
lucs left,
xxpor left,
ribasushi left,
a6502 left,
tadzik left,
protium left,
raku-bridge4 is now known as raku-bridge
02:10
Kaiepi joined,
aborazmeh joined,
sena_kun joined,
dataangel joined,
APic joined,
cpan-raku joined,
robinsmidsrod joined,
webstrand joined,
stux|RC-only joined,
APic left,
APic joined
02:11
BuildTheRobots left,
matiaslina left,
AlexDaniel` left,
unclechu left
02:12
xinming_ joined,
maggotbrain joined,
dogbert17 joined,
ensamvarg joined,
broquaint joined,
bdju joined,
molaf joined
02:13
jdv79 joined,
nine joined,
Mithaldu joined,
renormalist joined,
tomaw joined,
dpk joined,
timotimo joined,
benaiah joined,
xi joined,
cgfbee joined,
tinita joined,
Benett joined,
gabiruh joined,
Maylay joined,
veesh joined,
El_Che joined,
vike joined,
kybr joined,
Noisytoot joined,
m0ltar_ joined,
orinthe joined,
poga joined,
skyl4rk joined,
gordonfish joined,
nicholatian joined,
marcusr joined,
Guest91264 joined,
ManifestO joined,
k-man joined,
epony joined,
Zero_Dogg joined,
aindilis joined,
gugod joined,
HarmtH joined,
hvxgr joined,
cj joined,
elcaro joined,
tobs joined,
perryprog joined,
tailgate joined,
tardisx joined,
protium joined,
tadzik joined,
a6502 joined,
ribasushi joined,
xxpor joined,
lucs joined
02:14
a3r0 joined,
tony-o joined,
m_athias joined,
samebchase joined,
ambs joined,
releasable6 joined,
quotable6 joined,
sourceable6 joined,
benchable6 joined,
coverable6 joined,
shareable6 joined,
sergot_ joined,
dotdotdot joined,
pierrot joined,
karupanerura joined,
shadowpaste joined,
cibs joined,
gordonfish left,
dudz joined,
xkr47 joined,
smash joined,
a3f joined,
codesections joined,
cooper joined,
leah2 joined,
SmokeMachine joined,
fridim joined,
sftp joined,
ChoppedBacon joined,
mrsolo joined,
BinGOs joined,
ecocode joined,
zostay joined,
Roamer`_ joined,
xq joined,
simcop2387 joined,
esh joined,
rba joined,
jhill joined,
silug joined,
nebuchadnezzar joined,
stux|RC joined,
krunen joined,
sno joined,
sivoais_ joined,
lizmat joined,
Voldenet joined,
eseyman joined,
lnx joined,
mst joined
02:15
BuildTheRobots joined,
silug left,
nebuchadnezzar left,
stux|RC left,
krunen left,
sno left,
sivoais_ left,
lizmat left,
Voldenet left,
eseyman left,
lnx left,
mst left,
a3f left,
codesections left,
cooper left,
leah2 left,
SmokeMachine left,
fridim left,
sftp left,
ChoppedBacon left,
mrsolo left,
BinGOs left,
ecocode left,
zostay left,
Roamer`_ left,
simcop2387 left,
xq left,
esh left,
rba left,
dudz left,
xkr47 left,
smash left,
a3r0 left,
m_athias left,
samebchase left,
ambs left,
releasable6 left,
quotable6 left,
sourceable6 left,
benchable6 left,
coverable6 left,
shareable6 left,
sergot_ left,
dotdotdot left,
tony-o left,
pierrot left,
karupanerura left,
shadowpaste left,
cibs left,
El_Che left,
veesh left,
Maylay left,
gabiruh left,
Benett left,
tinita left,
cgfbee left,
xi left,
benaiah left,
timotimo left,
dpk left,
tomaw left,
renormalist left,
Mithaldu left,
nine left,
jdv79 left,
ManifestO left,
Guest91264 left,
marcusr left,
nicholatian left,
skyl4rk left,
poga left,
orinthe left,
m0ltar_ left,
Noisytoot left,
kybr left,
vike left,
tailgate left,
perryprog left,
tardisx left,
k-man left,
epony left,
Zero_Dogg left,
aindilis left,
gugod left,
HarmtH left,
hvxgr left,
cj left,
elcaro left,
tobs left,
lucs left,
xxpor left,
ribasushi left,
a6502 left,
tadzik left,
protium left,
jhill left,
unclechu joined,
dudz joined,
xkr47 joined,
smash joined,
peteretep left
02:16
unclechu left,
unclechu joined,
jhill joined,
sena_kun left,
ManifestO joined,
Guest91264 joined,
marcusr joined,
nicholatian joined,
skyl4rk joined,
poga joined,
orinthe joined,
m0ltar_ joined,
Noisytoot joined,
kybr joined,
vike joined,
rjeli left,
spycrab0 left,
kawaii left
02:17
timeless left,
stux|RC joined,
Grinnz left,
PotatoGim left
02:18
a3r0 joined,
tony-o joined,
m_athias joined,
samebchase joined,
ambs joined,
releasable6 joined,
quotable6 joined,
sourceable6 joined,
benchable6 joined,
coverable6 joined,
shareable6 joined,
sergot_ joined,
dotdotdot joined,
pierrot joined,
karupanerura joined,
shadowpaste joined,
cibs joined
02:19
silug joined,
nebuchadnezzar joined,
krunen joined,
sno joined,
sivoais_ joined,
lizmat joined,
Voldenet joined,
eseyman joined,
lnx joined,
mst joined,
tardisx joined,
tailgate joined,
perryprog joined,
El_Che joined,
veesh joined,
Maylay joined,
gabiruh joined,
Benett joined,
tinita joined,
xi joined,
benaiah joined,
timotimo joined,
dpk joined,
tomaw joined,
renormalist joined,
Mithaldu joined,
nine joined,
jdv79 joined,
cj joined,
Grinnz joined,
a3f joined,
codesections joined,
leah2 joined,
SmokeMachine joined,
fridim joined,
sftp joined,
ChoppedBacon joined,
mrsolo joined,
BinGOs joined,
ecocode joined,
zostay joined,
Roamer`_ joined,
xq joined,
simcop2387 joined,
esh joined,
rba joined,
elcaro joined,
hvxgr joined,
Grinnz left,
Grinnz joined
02:20
Grinnz left,
Grinnz joined,
spycrab0 joined,
spycrab0 left,
spycrab0 joined,
cgfbee joined,
cooper joined,
simcop2387 left,
cooper left,
cooper joined,
cooper left,
cooper joined,
sena_kun joined,
simcop2387 joined,
simcop2387 left,
simcop2387 joined,
peteretep joined,
tobs joined
02:21
k-man joined,
epony joined,
Zero_Dogg joined,
aindilis joined,
gugod joined,
HarmtH joined,
lucs joined,
xxpor joined,
ribasushi joined,
a6502 joined,
tadzik joined,
protium joined,
rjeli joined,
timeless joined,
kawaii joined
02:22
AlexDaniel` joined,
Nasrudin joined,
CIAvash joined,
matiaslina joined
02:25
PotatoGim joined
02:32
adu joined
02:47
e joined
03:10
vike left
03:20
xinming_ left
03:23
xinming_ joined
03:24
aborazmeh left
03:27
jmcgnh joined
03:32
xinming_ left
|
|||
Geth | doc: softmoth++ created pull request #3534: Call it "Pod", not "POD" or "Pod6" |
03:33 | |
03:34
xinming_ joined
03:36
vike joined
|
|||
cpan-raku | New module released to CPAN! Template::Mustache (1.2.2) by 03SOFTMOTH | 04:00 | |
04:08
gnufr33dom joined
04:09
NewGreyhawke joined
04:14
Altai-man_ joined
04:16
sena_kun left
04:21
wamba joined
04:36
mistersir joined
04:39
zacts joined,
OpenZen left
04:50
adu left
04:52
zacts left
04:59
andrzejku joined,
xinming_ left,
xinming_ joined
05:28
xinming_ left
05:30
Guest91264 is now known as aluaces
05:31
bocaneri joined
05:48
nebuchadnezzar left
05:49
wamba left
06:14
sena_kun joined
06:16
Altai-man_ left
06:19
cpan-raku left
06:20
cpan-raku joined,
cpan-raku left,
cpan-raku joined
06:59
NewGreyhawke left
07:09
skids left
07:41
rindolf joined
07:47
leont joined
08:09
schlaftier left
08:12
rindolf left
08:14
Altai-man_ joined
08:16
sena_kun left
08:37
molaf left
08:44
dakkar joined
08:50
rindolf joined
08:51
molaf joined
08:52
leont left,
oddp joined
09:45
markoong joined
09:50
markoong left
09:51
markoong joined
09:56
MasterDuke joined
10:00
Sgeo left
10:06
pecastro joined
10:14
sena_kun joined,
grumble is now known as rawr
10:16
Altai-man_ left
10:44
Ven`` joined
11:02
aborazmeh joined,
aborazmeh left,
aborazmeh joined
11:34
pi4 joined
11:39
molaf left
11:52
oja joined
11:53
andrzejku left
|
|||
timotimo | 64.media.tumblr.com/1d27d0909e2b21...aa2189.jpg - cat *.raku | 12:01 | |
12:11
nebuchadnezzar joined
12:14
dakkar left,
Altai-man_ joined
12:17
sena_kun left
12:24
andrzejku joined
12:28
Tirifto joined
12:36
aborazmeh_ joined,
aborazmeh_ left,
aborazmeh_ joined
|
|||
lizmat | prettygood :-) | 12:38 | |
12:38
aborazmeh left,
aborazmeh_ is now known as aborazmeh,
cpan-raku left
12:46
cpan-raku joined,
cpan-raku left,
cpan-raku joined
13:02
Petr37 joined
13:20
andrzejku left
13:39
Petr37 left
13:59
andrzejku joined,
Tirifto left
14:05
aborazmeh left
14:06
Xliff joined
|
|||
Xliff | Hi. Are enums fixed after definition, or can the MOP be used to extend them? | 14:07 | |
timotimo | i could imagine there exists caches somewhere, but otherwise i imagine you could. let's try, shall we | ||
Xliff | Here's what I'm trying to do: | 14:08 | |
gist.github.com/Xliff/600d1c8ba52c...f43fb24ccc | |||
timotimo | m: enum Blorp <One Two>; say Blorp.keys.raku; Blorp.^add_enum_value("hi", 5); say try Blorp("hi"); say try Blorp(5); | 14:09 | |
camelia | () Too many positionals passed; expected 3 arguments but got 4 in block <unit> at <tmp> line 1 |
||
timotimo | ah | 14:10 | |
m: enum Blorp <One Two>; say Blorp.keys.raku; Blorp.^add_enum_value(Pair.new("hi", 5)); say try Blorp("hi"); say try Blorp(5); | |||
camelia | () (Blorp) hi => 5 |
||
timotimo | m: enum Blorp <One Two>; say Blorp.keys.raku; Blorp.^add_enum_value(Pair.new("hi", 5)); say try Blorp("hi"); say try Blorp(5); say try Blorp.keys | ||
Xliff | Oooh! | ||
camelia | () (Blorp) hi => 5 () |
||
timotimo | keys doesn't do what i think, it needs to be Blorp::.keys | ||
and that's a package, which will most probably want a separate operation to add the new thing to it | |||
Xliff | enum Blorp <One Two>; say Blorp.keys.raku; Blorp.^add_enum_value(Pair.new("hi", 5)); say try Blorp("hi"); say try Blorp(5); say try Blorp::.keys | ||
evalable6 | () (Blorp) hi => 5 (One Two) |
||
timotimo | i imagine that one will refuse changes | 14:11 | |
perhaps even when you grab the underlying storage and nqp:: bind a key or something | |||
Xliff | enum Blorp <One Two>; say Blorp.keys.raku; Blorp.^add_enum_value(Pair.new("hi", 5)); say try Blorp("hi"); say try Blorp(5); say try Blorp::.keys; say One; say hi | ||
m: enum Blorp <One Two>; say Blorp.keys.raku; Blorp.^add_enum_value(Pair.new("hi", 5)); say try Blorp("hi"); say try Blorp(5); say try Blorp::.keys; say One; say hi | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: hi used at line 1 |
||
Xliff | So maybe a better thing to do would be to add constants that map to the enum. | 14:12 | |
The values I'm trying to add aren't new, so.... | |||
Best way to add a constant to a compunit? | |||
14:13
lucasb joined,
Tirifto joined
14:14
sena_kun joined
14:16
Altai-man_ left
14:19
vike left
|
|||
timotimo | "add" a constant "to a compunit"? sounds vaguely like you want a sub EXPORT | 14:20 | |
Xliff | Hmmm... Yeah. | 14:24 | |
Add an example export on that gist for me? I haven't had much luck adding things to the export table. Its easy when I can pass the whole Hash from EXPORT when I'm creating it wholesale. | 14:26 | ||
I mean... would I append values to ::EXPORT::DEFAULT in that case? | |||
14:38
Ven`` left
|
|||
timotimo | sorry, i haven't had to work with EXPORT in a long time, the only time i really used it was my ADT module but there i only export what i explicitly create | 14:40 | |
14:44
NewGreyhawke joined
15:01
molaf joined
|
|||
Xliff | timotimo: OK. Thanks! | 15:10 | |
15:36
andrzejku left
|
|||
tbrowder | \o hi folks | 15:40 | |
question on $*CWD, docs are a little fuzzy to me | 15:41 | ||
use case: | |||
in an interactive raku prog, pass my cwd to an installed modules subroutine. what is the best way to do that? | 15:42 | ||
like this: "somesub $*CWD" | 15:43 | ||
and in the sub: sub somesub($cwd)"? | 15:44 | ||
or? | |||
15:47
Tirifto left
|
|||
tbrowder | or is $*CWD defined magically inside the installed module? | 15:50 | |
defined/accessible... | 15:51 | ||
timotimo | $*CWD is a regular dynamic variable, it'll immediately be available if you've defined your own | ||
15:51
alvapan joined
|
|||
timotimo | dynamic variables are scoped "by the call stack" so to say | 15:51 | |
15:51
Tirifto joined
|
|||
tbrowder | so should i do something like: my $dir = $*CWD; my $res = somesub $dir | 15:54 | |
timotimo | no | ||
my $*CWD = "/foo/bar"; somesub() | |||
tbrowder | but the docs warn about that syntax | 15:55 | |
timotimo | where? | ||
tbrowder | input/output | 15:56 | |
15:56
alvapan left
|
|||
timotimo | docs.raku.org/language/io here? | 15:56 | |
tbrowder | no, the "definitive input/output guide" | 15:57 | |
timotimo | i didn't know this existed lol | ||
tbrowder | sorry, "input/output, the definitive guide" by Zoffix | 15:58 | |
timotimo | in that case, use temp $*CWD | ||
tbrowder | so, not knowing my curr dir, it seems like i shoud use "my $cwd = '.'.IO" and pass it to the sub and forget about $*CWD | 16:02 | |
timotimo | um | ||
your current dir is literally in $*CWD | 16:03 | ||
if you just want to pass your current dir on to the sub, just do nothing and call the sub, if it will use $*CWD | |||
tbrowder | ok, so the magic of dyn vars carries throughout--awesome! | 16:04 | |
but, just to be clear, i could do the "$dir = $*CWD; somesub $dir" to satisfy my stubborness? | 16:06 | ||
16:07
Tirifto left
16:08
wamba joined
|
|||
timotimo | yes, if somesub takes an argument for the path | 16:08 | |
16:08
Tirifto joined,
Tirifto left
|
|||
tbrowder | i'm going to be using File::Find inside that sub and want to be clear what's happening from the caller's perspective. | 16:08 | |
16:08
Tirifto joined
|
|||
tbrowder | timotimo: thanks! | 16:09 | |
16:14
Altai-man_ joined
|
|||
Geth | doc: usev6++ created pull request #3535: Tweak names of two variables |
16:15 | |
16:16
sena_kun left
16:28
Kaiepi left,
Kaiepi joined
16:31
Kaiepi left
16:39
melezhik joined
|
|||
melezhik | now Red has Postgresql tests with Rakudist - rakudist.raku.org/sparky/report/debian/542 | 16:40 | |
16:40
JJMerelo joined
16:45
Kaiepi joined
|
|||
timotimo | pretty nice | 16:47 | |
melezhik | yeah, thanks | 17:03 | |
basically Fernando asked me to restore test environment for Red/Pg and I did | 17:04 | ||
I have a free tier amazon subscription, so I just spin up a small ec2 instance with Postgresql on it, enough for things like testing Red module | 17:05 | ||
here is Red setup - github.com/melezhik/RakuDist/blob/...parrowfile | 17:06 | ||
17:08
wamba left
|
|||
timotimo | ah, the postgres instance is permanent | 17:09 | |
SmokeMachine | melezhik: \o/ | 17:30 | |
17:39
holyghost joined
|
|||
Geth | doc: 9db30691a6 | (Christian Bartolomäus)++ (committed using GitHub Web editor) | doc/Language/contexts.pod6 Tweak names of two variables (#3535) The original names had the potential to cause confusion. |
17:43 | |
linkable6 | Link: docs.raku.org/language/contexts | ||
DOC#3535 [closed]: github.com/Raku/doc/pull/3535 Tweak names of two variables | |||
17:46
Tirifto left
17:52
Tirifto joined
17:53
wamba joined
18:09
Tirifto left
18:10
xinming joined
18:14
sena_kun joined
18:16
Altai-man_ left
18:17
Sgeo joined,
Tirifto joined
|
|||
melezhik | SmokeMachine \o/ yeah, we did it! | 18:30 | |
timotimo yeah, in original version it was created on the same docker container, but I had some problems to run docker with systemd on new virtual server where RakuDist moved | 18:32 | ||
18:34
Tirifto left
|
|||
melezhik | so, I just decided to spin up a postgres separately on my ec2 instance, will work till my free tier is expired )) | 18:34 | |
but technically I might return ode day to the scheme all in one ( docker on the same docker ) approach, should not be a big deal | 18:35 | ||
ode -> one | |||
codesections | if I call `take` inside a hyper block, will the values I get in my `gather` be in the same order as my input? Or is `take`ing a side effect (like `say`) and they could be in any order? | ||
18:35
aindilis left
18:37
andrzejku joined,
vike joined
18:44
Tirifto joined
18:46
aindilis joined
19:05
Tirifto left
19:08
Tirifto joined
19:10
leont joined
|
|||
moritz | take is a side effect | 19:12 | |
19:13
guifa2 joined
|
|||
codesections | thanks | 19:15 | |
timotimo | it's possible that take-ing from multiple threads can be destructive to your data | 19:17 | |
hyper already collects your data for you, however, so perhaps you can Just??? Slip multiple results or Empty results you don't want | 19:19 | ||
guifa2 | Has anyone had much success lately with Net::FTP? Or is there a better ftp client these days? | ||
Xliff | When is sub EXPORT run? | 19:28 | |
timotimo | when something use-es your module | 19:29 | |
or requires or whatever | |||
Xliff | It doesn't seem to be running when I perl6 -e 'use Module' | ||
"sub EXPORT {}" is sufficient, yes? | |||
Voldenet | m: use nqp; $*CWD = "/"; say nqp::cwd() | ||
camelia | /home/camelia | ||
Voldenet | as expected | ||
codesections | These causes an infinite loop when I wouldn't expect it to: given 10 { when $_ < 0 { 'done' }; &?BLOCK($_ - 1) for ^2 } | ||
is the postfix `for` implicitly creating a block? | 19:30 | ||
Xliff | codesections: create a closure for the &?BLOCK call? | 19:31 | |
Or user OUTER:: | |||
lizmat | Xliff: the EXPORT should be in the compunit, but *not* in the package scope | ||
unit class Foo; sub EXPORT { } # wrong | |||
class Foo { } sub EXPORT { } # right | 19:32 | ||
codesections | Xliff: I don't understand. The `given` block should be a closure for the &?BLOCK call, right? I mean, this works | 19:35 | |
m: given 10 { .say; when $_ < 0 { 'done' }; &?BLOCK($_ - 1)} | |||
camelia | 10 9 8 7 6 5 4 3 2 1 0 -1 |
||
guifa2 | codesections: what would stop the loop? | 19:42 | |
codesections | I'm also not quite following the advice to use `OUTER::` and don't see anything about `OUTER::` in the docs | ||
guifa2: the when statement? | |||
Xliff | given 10 { when $_ < 0 { 'done' }; sub b($n) { &?OUTER::BLOCK($n) } b($_ - 1) for ^2 } | ||
m" given 10 { when $_ < 0 { 'done' }; sub b($n) { &?OUTER::BLOCK($n) } b($_ - 1) for ^2 } | 19:43 | ||
m: given 10 { when $_ < 0 { 'done' }; sub b($n) { &?OUTER::BLOCK($n) } b($_ - 1) for ^2 } | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Strange text after block (missing semicolon or comma?) at <tmp>:1 ------> 3one' }; sub b($n) { &?OUTER::BLOCK($n) }7⏏5 b($_ - 1) for ^2 } expecting any of: infix infi… |
||
Xliff | m: given 10 { when $_ < 0 { 'done' }; sub b($n) { &?OUTER::BLOCK($n) }; b($_ - 1) for ^2 } | ||
guifa2 | the &?BLOCK isn't being conditionally called | ||
perhaps you wanted to throw it in a "default"? | |||
camelia | MoarVM panic: Memory allocation failed; could not allocate 131072 bytes | ||
Xliff | codesections: Was acting on the thought that the for was creating an implicit block, as you suggested. | 19:44 | |
Looks the same, though. | |||
codesections | It's being conditionally *not* called, right? If the `when` statement is true, control flow exits the `given` block, right? | ||
Xliff | lizmat++ # Thanks! | ||
lizmat | yeah, been there done that :-) | 19:45 | |
codesections | xliff: oh, I see what you meant by OUTER | ||
guifa2 | no | ||
"when" juts means "run the code in this block if true" | |||
Xliff | Is the best way to access a symbol in EXPORT::DEFAULT -- "EXPORT::DEFAULT::{$sym}" ? | ||
guifa2 | m: given 10 { my &b = &?BLOCK; when * < 0 { say "done" }; default { b($_ - 1) } } | 19:48 | |
camelia | done | ||
Xliff | Oh. HAH! guifa++ | 19:49 | |
guifa2 | of course, you can't use &?BLOCK in the default block (I mean, you CAN, but it's referring to a different one) | ||
melezhik | I've added 2020.07 version to RakuDist, in case someone want to test against the latest version | 19:50 | |
codesections | m: given 10 { my &b = &?BLOCK; when * < 0 { say "done" }; b($_ - 1 } | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1) at <tmp>:1 ------> 3CK; when * < 0 { say "done" }; b($_ - 1 7⏏5} |
||
codesections | m: given 10 { my &b = &?BLOCK; when * < 0 { say "done" }; b($_ - 1) } | ||
camelia | done | ||
codesections | `default` wasn't doing any of the work there | ||
19:50
melezhik left
|
|||
codesections | From the docs: > But there is a difference in how following code in the same, outer block is handled: When the when block is executed, control is passed to the enclosing block and following statements are ignored; but when the if block is executed, following statements are executed. | 19:51 | |
guifa2 | hmmm | 19:52 | |
Xliff | 10 -> default -> 9 -> default -> 8 -> default ... 0 -> done | 19:53 | |
Without the default it still works, it's just.... if there are more when blocks after the call to b() then you may run into a sleeping dragon. | 19:54 | ||
^^ codesections | |||
codesections | assigning `my &b = &?BLOCK` works, though, thanks! It's a bit inelegant (since the idea of &?BLOCK is to have implicit recursion *without* naming to block) and reminds me a bit of the `that = this` from JavaScript… | ||
Xliff | codesections: You DO have implicit recursion, just be careful of implicit blocks! :) | 19:55 | |
guifa2 | eventually (though NYI) I believe we're supposed to be able to label all blocks rather than just loops | 20:00 | |
which should help with that | |||
codesections | Wait… I think (though I haven't figured out the details) that the problem *isn't* an implicit block – it's that postfix `for` is setting the topic! | 20:02 | |
guifa2 | oh right, because you're doing < 0 so it's calling it on the block for values of 0 and 1 each time | 20:04 | |
one of which terminates the other goes on forever | |||
codesections | (both of which go on forever, but yeah) | ||
20:05
wamba left
|
|||
guifa2 | err calling it with -1 and 0, because 0 - 1 and 1-1. | 20:06 | |
guifa2 needs his caffeine | |||
codesections | wait, wat | 20:07 | |
m: given 4 { .say; my $topic = $_; my &b = &?BLOCK; when $_ < 0 { 'done'}; b($topic - 1) for ^2}; say 'done'; | |||
camelia | 4 3 2 1 0 -1 -1 0 -1 -1 1 0 -1 -1 0 -1 -1 2 1 0 -1 -1 0 -1 -1 1 0 -1 -1 0 -1 -1 3 2 1 0 -1 -1 0 -1 -1 1 0 -1 -1 0 -1 -1 2 1 0 -1 -1 0 -1 -1… |
||
codesections | m: given 3 { .say; my $topic = $_; my &b = &?BLOCK; when $_ < 0 { 'done'}; b($topic - 1) for ^2}; say 'done'; | ||
camelia | 3 2 1 0 -1 -1 0 -1 -1 1 0 -1 -1 0 -1 -1 2 1 0 -1 -1 0 -1 -1 1 0 -1 -1 0 -1 -1 done |
||
guifa2 | for ^2 is the same as for (0, 1) | 20:08 | |
codesections | (Oops, yeah, I forgot it there was a `- 1` even the first time. So I was thinking it was 0 and 1, not -1 and 0. My bad; you're right that only one is ∞) | 20:09 | |
thundergnat | guifa2: FWIW Net::FTP works ok for the most part, it just won't pass it's tests because the test FTP server is offline. It works for me if I --force install it. | 20:12 | |
guifa2 | thundergnat: yeah I noticed that, but after installing I can't get it to connect to the IANA ftp server | ||
20:13
mistersir left
20:14
Altai-man_ joined,
JJMerelo left
20:16
sena_kun left,
Altai-man_ left
20:17
sena_kun joined
|
|||
thundergnat | guifa2: Sorry, I stand corrected. It worked the last time I tried it but seems to have bit-rotted since then. No longer works for me either. | 20:19 | |
guifa2 | thundergnat: at least it's not just me then | ||
Xliff | which is executed first? BEGIN or EXPORT? | 20:36 | |
guifa2 | Begin should be | ||
timotimo | yeah, EXPORT can only be run after it got parsed, after all | 20:37 | |
guifa2 | export is called at runtime, but begin is called at compile time | ||
timotimo | i'd say export is called at parse-time of the user of your module | 20:38 | |
Xliff | Hmmm... might have a chicken and egg problem. | 20:39 | |
I need the export table at BEGIN time. | |||
timotimo | at whose begin time? | ||
Xliff | HAH! | 20:40 | |
I have to have BEGIN defined after 'unit' | |||
Then sub EXPORT {} will pick it up, properly. | |||
\o/ | |||
One sec and then I can commit this. | |||
github.com/Xliff/p6-OpenVR/blob/ma.../Enums.pm6 | 20:51 | ||
20:52
Black_Ribbon joined
|
|||
guifa2 | Xliff: hmmm | 20:52 | |
So not fully grocking the BEGIN code, I'd say I'd move the sub export all the way down, and not attach the "is export" to everything, and manually make your map. But that's very off the cuff and I'd need to look at it a bit more in depth | 20:56 | ||
20:56
rindolf left
|
|||
Xliff | guifa: Um. No. Tried that. | 21:02 | |
sub EXPORT must be out of module def, so it has to be ABOVE "unit package" | |||
BEGIN needs to be after the unit def otherwise EXPORT::DEFAULT is unpopulated. | 21:04 | ||
The rest of the code is just there to add alternative constants to the enum due to weirdness in the C code I'm writing a binding for. | |||
21:06
NewGreyhawke left
21:07
xinming left,
leont left
21:08
xinming joined
21:28
Chidaruma666Onym joined
21:38
markoong left,
markoong joined
21:50
Tirifto left
21:55
Chidaruma666Onym left
|
|||
codesections | I'm still pretty confused by how `&?BLOCK` works (esp. with `OUTER` and/or `for` loops). So I wrote up a StackOverflow question stackoverflow.com/questions/630939...e-variable | 21:57 | |
21:58
andrzejku left
22:01
markong joined
|
|||
guifa2 | codesections: it looks like it may be a bug. Even using OUTER::OUTER::BLOCK I get the same | 22:01 | |
codesections | Yeah. And I didn | 22:05 | |
22:05
markoong left
|
|||
codesections | *didn't mention it in the question, but I tried other options (DYNAMIC, CALLER, etc) and always got the inner block's ID | 22:06 | |
guifa2 | Although that said, I don't know if it has that information available. Things are designed to be single pass | ||
And an inner block while be constructed before the outer | 22:07 | ||
codesections | That's why I didn't open an issue yet – I don't know if it's a bug, or just an inherent limitation | ||
22:13
Altai-man_ joined
22:14
reach_satori left,
reach_satori joined
22:16
sena_kun left
22:20
markong left
22:21
MilkmanDan left
22:28
xelxebar left
22:29
xelxebar joined
22:33
NewGreyhawke joined
|
|||
Xliff | OK. My latest foray into sub EXPORT has met with unexpected failure after passing the first test case. | 22:49 | |
22:52
MilkmanDan joined
|
|||
Xliff | And now... after reordering... it works again. Weird. | 22:52 | |
22:55
oja left
23:09
oddp left
|
|||
Xliff | Does raku do uint64 literals? | 23:16 | |
23:21
Zero_Dogg left,
Zero_Dogg joined
|
|||
codesections | m: my uint64 $a = 14; | 23:25 | |
camelia | ( no output ) | ||
codesections | Xliff: Like that? ^^^^ or do you mean something else? | 23:26 | |
Xliff | codesections: Not quite. I was wondering if there was a literal, like there is in C: 1L would create a 64-bit integer with the value of 1. | 23:30 | |
23:31
skids joined
|
|||
Xliff | I really didn't think so. Raku doesn't need 'em. | 23:31 | |
codesections | Oh, I'm with you now. I don't think Raku does (it's certainly not listed in the docs: according to them, we have Number, Int, Rat, Num, and Complex literals (for numeric types) but nothing about the size) | 23:33 | |
docs.raku.org/language/syntax#Int_literals | |||
23:37
skids left
23:47
MasterDuke left
|