🦋 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.
rf tonyo: I've having some troubles installing Fez on a SUSE server, it seems like it wants "libz" which I assume is zlib, which I have, what can I do? 01:55
japhb rf: I've been getting that lately too. Just do `zef install fez --exclude=libz` 02:04
(This really shouldn't be necessary, but I find it so for several modules.)
rf Weird 02:07
Seems to work excluding "libz" but I don't think that's intended
Xliff_ How can I determine if a lexical variable is writeable? 02:08
m: my $a; $a.VAR.^methods.map( *.name ).say 02:09
camelia (<anon> <anon> new name of default dynamic WHICH BUILDALL)
Xliff_ m: my $a; $a.VAR.^name.say
camelia Scalar
rf @lizmat I may be the first person in the world to use Raku to smoke meats
Got a contract offer to build a smart meat-thermometer for a large company, I would most likely write the scripted side in Raku :) 02:11
Xliff_ rf++ # Nice! Send me a demo unit? I can give you data!
rf Haha, I'll follow up in the coming weeks if they want to go ahead with it
Xliff_ m: sub a ($a) { $a.^name.say }; a 02:13
camelia ===SORRY!=== Error while compiling <tmp>
Calling a() will never work with declared signature ($a)
at <tmp>:1
------> sub a ($a) { $a.^name.say }; ⏏a
Xliff_ m: sub a ($a) { $a.^name.say }; a(1)
camelia Int
Xliff_ m: sub a ($a is copy) { $a.^name.say }; a(1)
camelia Int
rf Are you trying to see if a variable is constant?
Xliff_ No. I'm trying to see if the symbol itself can be written to.
m: sub a ($a is copy) { CATCH { default { .name.say }; $a.^name.say; b() }; sub b { OUTER::<$a> = 42 }; 02:15
camelia ===SORRY!=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> .say; b() }; sub b { OUTER::<$a> = 42 };⏏<EOL>
Xliff_ m: sub a ($a is copy) { CATCH { default { .name.say }; }; $a.^name.say; b() }; sub b { OUTER::<$a> = 42 };
camelia ( no output )
Xliff_ m: sub a ($a is copy) { CATCH { default { .name.say }; }; $a.^name.say; b() $a.say}; sub b { OUTER::<$a> = 42 };
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> ault { .name.say }; }; $a.^name.say; b()⏏ $a.say}; sub b { OUTER::<$a> = 42 };
expecting any of:
infix
infix stopper
Xliff_ m: sub a ($a is copy) { CATCH { default { .name.say }; }; $a.^name.say; b(); $a.say}; sub b { OUTER::<$a> = 42 };
camelia ( no output )
Xliff_ m: sub a ($a is copy) { $a.^name.say; b(); $a.say}; sub b { CATCH { default { .name.say }; }; OUTER::<$a> = 42 }; 02:16
camelia ( no output )
Xliff_ WTF?
m: sub a ($a is copy) { $a.^name.say; b(); $a.say}; sub b { CATCH { default { .^name.say }; }; OUTER::<$a> = 42 };
camelia ( no output )
Xliff_ m: sub a ($a is copy) { $a.^name.say; b(); $a.say}; sub b { CATCH { default { .^name.say }; }; OUTER::<$a> = 42; say "boop!" }; 02:17
camelia ( no output )
rf m: sub a ($a is copy) { $a.^name.say; b(); $a.say}; sub b { CATCH { default { .^name.say }; }; OUTER::<$a> = 42; say "boop!" }; b();
camelia X::Assignment::RO
Xliff_ Thanks. I guess that will have to do.
m: sub a ($a is copy) { $a.^name.say; b(); $a.say}; sub b { CATCH { default { .^name.say }; }; OUTER::<$a> = 42; say "boop!" }; a() 02:18
camelia ===SORRY!=== Error while compiling <tmp>
Calling a() will never work with declared signature ($a is copy)
at <tmp>:1
------> }; }; OUTER::<$a> = 42; say "boop!" }; ⏏a()
Xliff_ m: sub a ($a is copy) { $a.^name.say; b(); $a.say}; sub b { CATCH { default { .^name.say }; }; OUTER::<$a> = 42; say "boop!" }; a(1)
camelia Int
X::Assignment::RO
1
Xliff_ m: sub a ($a is rw) { $a.^name.say; b(); $a.say}; sub b { CATCH { default { .^name.say }; }; OUTER::<$a> = 42; say "boop!" }; a(1) 02:19
camelia Parameter '$a' expects a writable container (variable) as an argument,
but got '1' (Int) as a value without a container.
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
rf Can't pass 1 to rw 02:20
Or any constant for that matter
Xliff_ I know, but "$a is copy" should make $a a lexical container
rf I thought it merely copied the container to $a
Xliff_ So OUTER::<$a> should be writeable.
Otherwise this shouldn't work..., 02:21
m: sub a ($a is copy) { $a.^name.say; $a = 2; $a.say }; a(1)
camelia Int
2
rf m: my $s = 1; sub a ($a is copy) { $a := 3 }; a(5); say $s;
camelia 1
rf m: my $s = 1; sub a ($a is copy) { $a := 3 }; a($s); say $s; 02:22
camelia 1
rf m: sub f ($a) { $a := 5 }; f(10); 02:23
camelia ===SORRY!=== Error while compiling <tmp>
Cannot bind to '$a' because it was bound in a signature and variables
bound in signatures cannot be rebound unless they were declared with the
'is rw' or 'is copy' traits
at <tmp>:1
------> su…
rf :)
Xliff_ m: sub f ($a is copy) { $a := 5 }; f(10); 02:24
camelia ( no output )
Xliff_ m: sub f ($a is copy) { $a = 5 }; f(10);
camelia ( no output )
Xliff_ m: sub b { OUTER::<$a> = 42 }; sub f ($a is copy) { $a = 5; b() }; f(10);
camelia Cannot modify an immutable Nil value
in sub b at <tmp> line 1
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff_ m: sub b { OUTER::<$a>.say }; sub f ($a is copy) { $a = 5; b() }; f(10);
camelia Nil
rf Is OUTER RakuAST stuff? 02:25
Xliff_ m: sub b { OUTER::.keys }; sub f ($a is copy) { $a = 5; b() }; f(10);
camelia ( no output )
Xliff_ m: sub b { OUTER::.keys.say }; sub f ($a is copy) { $a = 5; b() }; f(10);
camelia ($_ $?PACKAGE $! $¢ EXPORT $=pod &b $=finish &f $/ GLOBALish !UNIT_MARKER ::?PACKAGE)
Xliff_ m: sub b { CALLER::.keys.say }; sub f ($a is copy) { $a = 5; b() }; f(10);
camelia ($¢ $/ $a $!)
Xliff_ AHAHAHAHA!
m: sub b { CALLER::<$a> = 42 }; sub f ($a is copy) { $a = 5; b() }; f(10);
camelia Cannot access '$a' through CALLER, because it is not declared as dynamic
in sub b at <tmp> line 1
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff_ :S
lizmat .tell Xliff I understand what the .ast and .set-ast would do, but I seem to be missing how that would only make that "only available at BEGIN and CHECK" 08:58
tellable6 lizmat, I'll pass your message to Xliff_
Xliff . 11:03
tellable6 2023-06-24T08:58:08Z #raku <lizmat> Xliff I understand what the .ast and .set-ast would do, but I seem to be missing how that would only make that "only available at BEGIN and CHECK"
Xliff lizmat: .ast and .set-ast are compile-time available items. Objects would not have them earlier. 11:04
lizmat: .ast and .set-ast are compile-time available items. Objects would not have them earlier. 11:05
Does that make sense?
leont m: dd (False xor False), (True xor True) 13:53
camelia Bool::False
Nil
leont Why is True xor True Nil? That looks like a bug to me, or am I missing something 13:54
nemokosch m: say(True ^^ True) 13:57
Raku eval Nil
nemokosch oh right... this operator has funny semantics 13:58
docs.raku.org/language/operators#infix_^^ 13:59
Xliff Anyone here familiar with the Raku parser? 14:04
nemokosch probably not familiar enough but you know 14:07
"don't ask to ask - just ask" 14:08
Xliff Yeah, well I'm wondering when the objects are created at compile time so that they can be accessed at BEGIN time 14:15
Xliff m: $a = 1; CHECK { $*CU.gist.say } 14:22
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$a' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> <BOL>⏏$a = 1; CHECK { $*CU.gist.say }
Xliff m: my $a = 1; CHECK { $*CU.gist.say } 14:23
camelia ===SORRY!=== Error while compiling <tmp>
An exception X::Dynamic::NotFound occurred while evaluating a CHECK: Dynamic variable $*CU not found
at <tmp>:1
Exception details:
Dynamic variable $*CU not found
in block at <tmp> line 1…
Xliff m: use experimental :rakuast; my $a = 1; CHECK { $*CU.gist.say }
camelia ===SORRY!=== Error while compiling <tmp>
An exception X::Dynamic::NotFound occurred while evaluating a CHECK: Dynamic variable $*CU not found
at <tmp>:1
Exception details:
Dynamic variable $*CU not found
in block at <tmp> line 1…
Xliff Rut Roh!
rf Morning folks 15:11
Xliff 'morning rf! 15:20
Anton Antonov @rf You should like my "monadic parsers" efforts. Have you used parser combinators (in any language) ? 15:55
rf Yes In Haskell and OCaml 16:24
Mostly for toys though I've never used them practically 16:25
Anton Antonov @rf Good to know. I should/will make a "very practical" example. 16:28
rf Haha in Raku? :P 16:29
Anton Antonov @rf Yes in Raku. See "FunctionalParsers" : raku.land/zef:antononcube/FunctionalParsers 16:48
rf ◁ I like the choice in Symbols Anton 16:59
Anton Antonov @rf Thanks! I was still have not figured out which one is the best set of operators. 17:16