🦋 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. |
|||
clarkema1 | how about that? | 00:00 | |
00:01
lichtkind__ left
|
|||
ugexe | that sounds like the best option so far | 00:02 | |
clarkema1 | ok, i'll write both changes up tomorrow then. Gotta head off for now | 00:05 | |
thanks for the help | |||
02:35
constxqt_ left
02:39
constxqt_ joined
02:47
kylese left,
kylese joined
02:48
constxqt_ left
02:55
simcop2387 left,
perlbot left
02:57
constxqt_ joined
03:15
kylese left,
kylese joined,
constxqt_ left
03:16
constxqt_ joined
03:23
jpn joined
03:26
constxqt_ left
03:28
jpn left
03:45
Sgeo left
03:50
Sgeo joined
03:53
cm left
04:02
cm joined
04:03
simcop2387 joined
04:04
perlbot joined
05:13
systems_ joined
07:14
mark22k6 joined
07:15
hexology left,
summerisle left,
hexology joined,
japhb left
07:16
japhb joined,
mark22k left,
mark22k6 is now known as mark22k,
bd3i left,
summerisle joined,
bd3i joined
07:35
melezhik joined
|
|||
melezhik | m: unit module Foo; | 07:36 | |
camelia | ( no output ) | ||
melezhik | m: unit module Foo; sub foo is export () {}; say ::("UNIT::EXPORT::FOO::").keys | 07:37 | |
camelia | ===SORRY!=== Error while compiling <tmp> Missing block at <tmp>:1 ------> unit module Foo; sub foo is export⏏ () {}; say ::("UNIT::EXPORT::FOO::").ke expecting any of: new name to be defined |
||
melezhik | [10:37:15] melezhik: m: unit module Foo; sub foo is export () {}; say ::("UNIT::EXPORT::FOO::").keys | 07:38 | |
m: unit module Foo; sub foo is export () {}; say ::("UNIT::EXPORT::FOO::").keys | |||
camelia | ===SORRY!=== Error while compiling <tmp> Missing block at <tmp>:1 ------> unit module Foo; sub foo is export⏏ () {}; say ::("UNIT::EXPORT::FOO::").ke expecting any of: new name to be defined |
||
07:38
melezhik left
07:49
melezhik joined
07:50
melezhik left
07:56
melezhik joined
|
|||
melezhik | m: unit module Foo; sub foo is export () { say 111 }; say ::("UNIT::EXPORT::FOO::").keys | 07:57 | |
camelia | ===SORRY!=== Error while compiling <tmp> Missing block at <tmp>:1 ------> unit module Foo; sub foo is export⏏ () { say 111 }; say ::("UNIT::EXPORT::F expecting any of: new name to be defined |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; say ::("UNIT::EXPORT::FOO::").keys | ||
camelia | No such symbol 'UNIT::EXPORT::FOO::' in block <unit> at <tmp> line 1 |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; say ::("UNIT::EXPORT::Foo::").keys | 07:59 | |
camelia | No such symbol 'UNIT::EXPORT::Foo::' in block <unit> at <tmp> line 1 |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; say ::("UNIT::EXPORT::").keys | 08:00 | |
camelia | No such symbol 'UNIT::EXPORT::' in block <unit> at <tmp> line 1 |
||
08:01
melezhik left
08:12
systems_ left
08:18
melezhik joined
|
|||
melezhik | I try to do a dynamic lookup in tables of symbols and looks like ::("foo::bar::what::ever::EXPORT::DEFAULT::").keys construction does not work for me , any ideas ? | 08:20 | |
In comparison direct lookup seems to work : foo::bar::what::ever::EXPORT::DEFAULT::.keys | 08:21 | ||
But in my case I would I need a dynamic lookup because module name is dynamic variable | 08:22 | ||
08:26
jpn joined
|
|||
melezhik | Reading this - stackoverflow.com/questions/670407...me-in-raku | 08:29 | |
08:30
constxqt_ joined
08:31
jpn left
08:32
melezhik left
09:39
abraxxa-home joined
09:41
jpn joined
09:45
abraxxa-home left
09:46
jpn left
09:47
abraxxa-home joined
09:52
jpn joined
10:13
lichtkind__ joined
10:16
constxqt_ left
10:19
jpn left
10:21
jpn joined
10:49
sena_kun joined
10:52
jpn left
10:55
jpn joined
11:11
jpn left
11:24
melezhik joined
11:26
Sgeo left
|
|||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT ").WHO.keys | 11:28 | |
camelia | () | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT").WHO.keys | 11:29 | |
camelia | (&foo) | ||
melezhik | Here we are ))) this should be WHO, not ::: for dynamically loaded modules | 11:30 | |
m: unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT ").WHO.keys.head | |||
camelia | Nil | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT ").WHO.keys -> $f { say $f } | 11:31 | |
camelia | ( no output ) | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT ").WHO.keys -> $f { say "ok" } | ||
camelia | ( no output ) | ||
nemokosch | m: unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT")::.keys | 11:32 | |
evalable6 | () | ||
Raku eval | () | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT ").WHO.keys() -> $f { say "ok" } | ||
camelia | ( no output ) | ||
nemokosch | m: unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT").WHO.keys | ||
evalable6 | (&foo) | ||
Raku eval | (&foo) | ||
nemokosch | why is there a difference... | 11:33 | |
melezhik | Between what? | ||
:: and WHO ? | |||
m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT ").WHO.keys() -> $f { say &::($f).signature } | 11:37 | ||
camelia | ( no output ) | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT ").WHO.keys-> $f { say &::($f).signature } | ||
camelia | ===SORRY!=== Error while compiling <tmp> Unsupported use of -> as postfix. In Raku please use: either . to call a method, or whitespace to delimit a pointy block. at <tmp>:1 ------> r ::("Foo::EXPORT::DEFAULT ").WHO.keys->⏏ $f … |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT ").WHO.keys -> $f { say &::($f).signature } | ||
camelia | ( no output ) | ||
melezhik | <nemokosch> m: unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT").WHO.keys.perl | 11:38 | |
unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT").WHO.keys | |||
evalable6 | (&foo) | ||
melezhik | unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT").WHO.keys.perl | 11:39 | |
evalable6 | ("\&foo",).Seq | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT ").WHO.keys<> -> $f { say &::($f).signature } | ||
camelia | ( no output ) | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; my @s = ::("Foo::EXPORT::DEFAULT ").WHO.keys; for @s -> $f { say $f } | 11:41 | |
camelia | ( no output ) | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; my @s = ::("Foo::EXPORT::DEFAULT ").WHO.keys; say @s.raku | 11:42 | |
camelia | [] | ||
nemokosch | In vrurg's workshop from like 2 years ago, :: was promoted as sugar for .WHO | ||
which it apparently isn't... | |||
melezhik | Well stack overflow post says that :: does not work for dynamic look up , while WHO does | 11:43 | |
In my case I need dynamic look up | |||
unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT").WHO.raku | 11:44 | ||
evalable6 | {"\&foo" => sub foo { #`(Sub|3833481475584) ... }} | ||
melezhik | unit module Foo; sub foo () is export { say 1000 }; say ::("Foo::EXPORT::DEFAULT").WHO.head | 11:45 | |
evalable6 | &foo => &foo | ||
melezhik | unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO -> $k, $v { say $k } | 11:46 | |
m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO -> $k, $v { say $k } | |||
camelia | Too few positionals passed; expected 2 arguments but got 1 in block at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO -> $v { say $v } | 11:48 | |
camelia | &foo => &foo | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO -> $v { say $v.head } | ||
camelia | &foo => &foo | ||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO -> $v { say &::($v.head).signature } | 11:50 | |
camelia | Sub object coerced to string (please use .gist or .raku to do that) in block at <tmp> line 1 No such symbol '' in block at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.values -> $v { say &::($v).signature } | 11:51 | |
camelia | Sub object coerced to string (please use .gist or .raku to do that) () in block at <tmp> line 1 |
||
11:52
melezhik left
11:53
melezhik joined
11:55
jpn joined
|
|||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO -> $o { say &::($o.key).signature } | 11:56 | |
camelia | No such symbol '' in block at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.kv -> $k, $v { say &::($k).signature } | 11:58 | |
camelia | No such symbol '' in block at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.kv -> $k, $v { say &::($v).signature } | ||
camelia | Sub object coerced to string (please use .gist or .raku to do that) () in block at <tmp> line 1 |
||
melezhik | m: unit module Foo; sub foo () is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.kv -> $k, $v { say $v.signature } | ||
camelia | () | ||
melezhik | m: unit module Foo; sub foo (Int $a ) is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.kv -> $k, $v { say $v.signature } | 11:59 | |
camelia | (Int $a) | ||
melezhik | This is what I wanted ))) | 12:00 | |
m: unit module Foo; sub foo (Int $a ) is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.kv -> $k, $v { say $v.name; say $v.signature } | |||
camelia | foo (Int $a) |
||
melezhik | m: unit module Foo; sub foo (Int $a ) is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.values -> $v { say $v.name; say $v.signature } | 12:01 | |
camelia | foo (Int $a) |
||
melezhik | Working code ))) | 12:02 | |
m: unit module Foo; sub foo (Int :$a ) is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.values -> $v { say $v.name; say $v.signature } | |||
camelia | foo (Int :$a) |
||
melezhik | m: unit module Foo; sub foo (:%a(:$b)) ) is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.values -> $v { say $v.name; say $v.signature } | 12:04 | |
camelia | ===SORRY!=== Shape declaration with () is reserved; please use whitespace if you meant a subsignature for unpacking, or use the :() form if you meant to add signature info to the function's type at <tmp>:1 ------> unit module Foo… |
||
melezhik | m: unit module Foo; sub foobar (Int :$a ) is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.values -> $v { say $v.name; say $v.signature } | 12:06 | |
camelia | foobar (Int :$a) |
||
melezhik | m: unit module Foo; sub foo (Int :$a ) is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.values -> $v { say $v.name; say $v.signature; $v(10); }; | 12:07 | |
camelia | foo Too many positionals passed; expected 0 arguments but got 1 in sub foo at <tmp> line 1 in block at <tmp> line 1 in block <unit> at <tmp> line 1 (Int :$a) |
||
melezhik | m: unit module Foo; sub foo (Int :$a ) is export { say 1000 }; for ::("Foo::EXPORT::DEFAULT").WHO.values -> $v { say $v.name; say $v.signature; $v(:a<10>); }; | 12:08 | |
camelia | foo (Int :$a) 1000 |
||
12:09
melezhik left,
melezhik joined
12:14
melezhik left
12:15
jpn left
|
|||
nemokosch | > Well stack overflow post says that :: does not work for dynamic look up , while WHO does | 12:26 | |
then it really isn't sugar for the same thing | |||
12:28
jpn joined
12:43
jpn left
13:03
abraxxa-home left
|
|||
SmokeMachine | lizmat: is it ok to use irclogs.raku to generate automated summaries of what’s happening on Raku channels? | 13:10 | |
lizmat: if that’s ok, is there any endpoint I could get only the conversation in plain text? | 13:11 | ||
I’m playing with this currently (you need iPhone’s shortcut and ChatGPT app installed): www.icloud.com/shortcuts/126a16822...d30b17f173 | 13:14 | ||
vrurg | nemokosch: Who told you that WHO works for dynamic lookups? Have you compared AST for `Hash::` and `Hash.WHO`? I'd recommend you to try and see on your own. | 14:01 | |
A standalone :: creates a PseudoStash, which is a hash as well as .WHO. Therefore their use is identical. Therefore in some contexts it's OK not to focus on the differences. | 14:03 | ||
14:10
constxqt_ joined
|
|||
nemokosch | .WHO does work for dynamic lookups | 14:50 | |
lizmat | SmokeMachine: irclogs.raku.org/raku/2023-12-03.log would be today's raw log | 14:57 | |
the format is basically /channel/YYYY-MM-DD.log | 14:58 | ||
SmokeMachine | lizmat: thanks! | 15:03 | |
15:05
melezhik joined
|
|||
melezhik | hi @vrurg - it was me who said that, but I base my judgment on this - stackoverflow.com/questions/670407...me-in-raku | 15:06 | |
also: :: does not work with dynamic look ups | 15:10 | ||
while WHO does, you could take a look at my previous examples | |||
15:15
melezhik left
|
|||
vrurg | .tell melezhik Actually, "dynamic lookup" in Raku means "resolve a $*VAR via the call stack", roughly. Using it in the sense of "at run-time" is rather misleading. | 15:26 | |
tellable6 | vrurg, I'll pass your message to melezhik | ||
mort | boxed variables in raku can be nil, right? How do I check an Int variable for nil? | 15:33 | |
trying with `== Nil` or `=== Nil` just gives me use of uninitialized value warnings, even though the value is initialized to Nil | |||
lizmat | mort: one seldom checks for Nil explicitely | 15:34 | |
usually it's with .defined | |||
mort | I need one behavior if the variable is set, and another behavior if it's not set; is `if $thing.defined` the right way to do that then | ||
lizmat | m: my Int $a; with $a { say "it is $_" } | ||
camelia | ( no output ) | ||
lizmat | m: my Int $a = 42; with $a { say "it is $_" } | ||
camelia | it is 42 | ||
mort | I'll use .defined, that seems to work | 15:36 | |
15:38
jpn joined
15:45
jpn left
|
|||
lizmat | mort: fwiw, "with $a {" is basically: if $a.defined && $a -> $_ { | 15:54 | |
mort | m: my Int $a; with $a { say "it is $_" } else { say "it is not defined" } | ||
camelia | it is not defined | ||
ab5tract | I was just typing the same | ||
mort | so with-else is possible, interesting | ||
lizmat | note there's also a "without" | 15:55 | |
Nahita | with $a corresponds to if $a.defined only right? doesn't impose && $a | ||
ab5tract | m: with 0 -> $z { dd $z } | 15:56 | |
camelia | 0 | ||
ab5tract | Nahita: indeed :) | 15:57 | |
15:58
jpn joined
|
|||
nemokosch | Well, it allows setting of a topic, like given | 16:03 | |
16:11
melezhik joined
|
|||
melezhik | . | 16:11 | |
tellable6 | 2023-12-03T15:26:18Z #raku <vrurg> melezhik Actually, "dynamic lookup" in Raku means "resolve a $*VAR via the call stack", roughly. Using it in the sense of "at run-time" is rather misleading. | ||
melezhik | tellable6: vrurg: that the term which is used in the official Rakudo documentation - docs.raku.org/language/modules#Exp..._importing | 16:12 | |
tellable6 | melezhik, I'll pass your message to vrurg | ||
melezhik | tellable6: vrurg : "require" section actually in this link | 16:14 | |
tellable6 | melezhik, I'll pass your message to vrurg | ||
16:15
melezhik left
|
|||
vrurg | Something has to be done to the documentation terminology. | 16:19 | |
ab5tract | nemokosh: do you consider rakudo/rakudo!5170 resolved? | 16:34 | |
dang, I messed up the linkable syntax | 16:35 | ||
nemokosch | what is the current behavior? | ||
ab5tract | R#5170 | 16:36 | |
linkable6 | R#5170 [open]: github.com/rakudo/rakudo/issues/5170 Feature: warn on assigning a Block to a Hash | ||
ab5tract | m: my %h = { my $a; } | 16:37 | |
camelia | Cannot use a Callable as the only argument to store in a Hash. If the intent was to store the contents of a Hash, one should probably use the %( ) hash constructor instead of { }. Causes of { } misinterpretation: - using ';' instead of ',' to … |
||
ab5tract | I just wanted to double check with you before I closed it | ||
nemokosch | bisectable: my %h = { my $a; } | 16:39 | |
bisectable6 | nemokosch, Will bisect the whole range automagically because no endpoints were provided, hang tight | ||
nemokosch, Output on all releases: gist.github.com/8cb63c2ba6cf66f826...edfd42d0ca | 16:40 | ||
nemokosch, More than 3 changes to bisect, please try a narrower range like old=2023.05 new=HEAD | |||
nemokosch | I think this is good to go | ||
ab5tract | one more stale bug report closed | 16:49 | |
SmokeMachine | Thanks! Now I’m doing it like this: www.icloud.com/shortcuts/87a4a1910...b82ec7ccec | 16:53 | |
mort | does raku have something like python's `mystring in ("foo", "bar", "baz")` to check if the variable is "foo", "bar" or "baz"? | 16:56 | |
leont | `$mystring eq any("foo", "bar", "baz")` | 16:57 | |
mort | damn I actually tried to google for the any function but I couldn't find anything other than the Any type | 16:58 | |
leont really should finish their article on junctions, they're way more powerful than in is | |||
Mainly because they're not limited to equality | 16:59 | ||
lizmat | also: $mystring (elem) ("foo", "bar", "baz") | 17:01 | |
nemokosch | yeah that's more similar | ||
17:29
kjp left
17:44
melezhik joined
|
|||
melezhik | tellable6: vrurg: sure, what the terminology is I meant that I need a symbolic table lookup for a module that is required in runtime rather then used in compile time | 17:46 | |
tellable6 | melezhik, I'll pass your message to vrurg | ||
17:47
melezhik left
17:49
melezhik joined
17:51
melezhik left
18:00
abraxxa-home joined
18:27
lichtkind_ joined
18:31
lichtkind__ left
18:46
MasterDuke joined
19:28
jpn left
19:44
antim0d3s left
19:45
sdfgsdfg joined
19:51
simcop2387 left,
perlbot left
19:56
perlbot joined
19:57
simcop2387 joined
20:16
frithnanth joined
20:18
frithnanth left
20:27
Sgeo joined
20:46
kjp joined
21:01
jpn joined
21:06
jpn left
21:36
jpn joined
21:44
jpn left
21:49
summerisle is now known as eof
22:05
sena_kun left
22:48
sdomi left
22:49
sdomi joined
23:02
abraxxa-home left
23:45
jpn joined
23:50
jpn left
|