🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | 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 8 June 2022.
jdv codesections: afaik the parser is the major perf issue, right? i dont get how a nailgun helps much. 03:27
lucs What's the difference (if any) between 「my Foo $bar = 42」 and 「my Foo() $bar = 42」? (that 「()」 has me confused). 03:46
japhb "Can be cast to Foo" I believe 03:47
lucs Hmm... Not sure what you mean...
japhb Coerced, sorry
The first says "Is already type Foo (or a subclass or role composer, or whatever)" 03:48
The second merely says you can get to Foo() by pushing on it.
jdv is it that "()" implies "action"
or something:) 03:49
japhb This is used for example for IO(), which will take a Str (not an IO already), assume the string is a path, and convert it to an IO::Path -- which actually *is* an IO
Yeah
lucs I'll reflect on that and ask again tomorrow if it's still unclear (when I'm sober that is). 03:52
jdv good night 03:53
lucs Thanks, you too :-)
Voldenet m: class Foo { method COERCE(Int $i) { Foo.new() }; }; my Foo $x = 42; 04:26
camelia Type check failed in assignment to $x; expected Foo but got Int (42)
in block <unit> at <tmp> line 1
Voldenet m: class Foo { method COERCE(Int $i) { Foo.new() }; }; my Foo() $x = 42;
camelia ( no output )
Voldenet lucs: ^ the difference 04:27
in first case assigned value must be accepted by Foo, in the latter it can be coerced into Foo 04:29
imo coercing is usually like operator overloading - leads to surprising code and difficult to debug behaviours if you abuse it 04:39
Nemokosch The question is, what counts as abuse 05:59
as usual
Voldenet the answer is fairly obvious, "using it when you don't need it" :) 06:10
like using shift left as stream writing operator 06:11
I'm glad that nobody would've considered that a good idea
Nemokosch regardless which operator it is, it did solve an actual problem compared to printf 06:14
let alone in a low-level environment where you don't want to create unnecessary objects
Voldenet just kidding, I still like it more than `format("%1% %2% %3%") % what % the % hell` 06:17
although `cout.say(1, 2, 3, 4).say(hex, setw(8), 42).say(3)` would sound more sane 06:20
and doesn't require magic operators
or `cout.say(what, " ", the, " ", hell)` 06:21
Nemokosch `cout.say(1, 2, 3, 4).say(hex, setw(8), 42).say(3)` this doesn't look sane for me at least 😛 06:51
in fact, out of habit, I still use C-style format strings in Python xD
not always but definitely most of the time
for C++, the key idea was that the "conversion" (which usually doesn't require memory allocation since it's not a real conversion) is given at compile time 06:53
Voldenet it's sane imo because all of those are simple methods with obvious resolution 06:55
Nemokosch indeed, they could use a method call, like cout.push(...).push(...)
and I think that would even work with templates
although that would also kinda raise problems
because you'd still need to describe what can be pushed
sure about either of those? 06:57
it looks like a chainable variadic method
why both chainable and variadic?
Voldenet Well, variadic – not necessarily
Nemokosch also, what is "hex, setw(8), 42"? 06:58
Voldenet > say(digit_specifier, padding_specifier, number) 06:59
Nemokosch okay, if you have an integer 07:00
Voldenet as C# have shown, `variadic` actually can mean defining methods with 1..4 args :D
Nemokosch tbh if this is for integer only, maybe it doesn't even need an overload; it can be a standalone thing for integers 07:01
Voldenet for std::floating_point you'd have something like std::hefloat here 07:02
hexfloat
Nemokosch anyway, I'm not 100% sure you could define your own types on the fly with this 07:03
the operators are like cheating with global functions 😄
Voldenet we're going too deep into C++ :P 07:05
Nemokosch yeah tbh I haven't used enough C++ for this
it's just, there is a reason why noone else did this 07:06
and there is also a reason why _they_ in particular did this
Voldenet well, the `say` would be not very useful without modern features 07:14
Geth ecosystem: 47fecc4cc2 | (Elizabeth Mattijsen)++ | META.list
Remove ake

It now lives in the zef ecosystem
07:15
Geth problem-solving/add-heah-skip-tail-subs: bd514d6da2 | (Elizabeth Mattijsen)++ | solutions/language/Add-head-skip-tail-subs.md
Add solution for #328
11:04
Geth problem-solving: lizmat++ created pull request #329:
Add solution for #328
11:04
lizmat clickbaits rakudoweekly.blog/2022/06/27/2022-...-seasoned/ 11:24
Geth doc/cpanfile-versioning: 29b8d7397c | (Daniel Mita)++ (committed using GitHub Web editor) | cpanfile
Set max AssetPack version in cpanfile
15:44
doc: m-dango++ created pull request #4094:
Set max AssetPack version in cpanfile
15:45
[Coke] can I support a numeric arg to MAIN, e.g. '-3' ? 16:23
Getting an error ATM, "cannot declare a numeric parameter" (trying to use the common-args trick that japhb showed yesterday) 16:24
trying to mimic 'cal -3' 16:31
ugexe m: sub MAIN(Num() :$n) { say $n.raku }; BEGIN @*ARGS = <--n=3.0> 16:37
camelia 3e0
ugexe although to me it seems like Num without the coercion should have worked
[Coke] I don't want -n=3, I want -3 16:40
Looking like I'd need to manually process it.
[Coke] m: sub MAIN(:$3) { say "hi"}; BEGIN @*ARGS=<-3>; 16:42
camelia ===SORRY!=== Error while compiling <tmp>
Cannot declare a numeric parameter
at <tmp>:1
------> sub MAIN(:$3⏏) { say "hi"}; BEGIN @*ARGS=<-3>;
[Coke] m: sub MAIN(:${3}) { say "hi"}; BEGIN @*ARGS=<-3>;
camelia ===SORRY!=== Error while compiling <tmp>
Shape declaration is not yet implemented; please use whitespace if you meant something else
at <tmp>:1
------> sub MAIN(:$⏏{3}) { say "hi"}; BEGIN @*ARGS=<-3>;
expecting any of:
[Coke] www.youtube.com/playlist?list=PLA9...T93dPUdtpE - is there any easy way to pick out the Raku ones? 17:31
(i mean, title title's a good place to start, but not everything has raku or perl in it) 17:32
ugexe i thought every raku talk had raku in the title 17:33
i guess not
[Coke] Maybe they do, but the lack of "perl" made me suspicious. :)
ugexe Three Ways to Make Code Look Wronger 17:34
Nemokosch good one 18:03
lizmat [Coke]: the weekly has the Raku ones available at press time 20:02
guifa 's still haven't been posted but for the LT 20:23