🦋 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.
tbrowder melezhik: haven't had time...will be awhile... 01:52
Mrtophat huh 17:22
lizmat eh? 17:23
weekly: bsky.app/profile/richardkadrey.bsk...hlcqzvz222 17:24
notable6 lizmat, Noted! (weekly)
tbrowder lizmat: will you be putting Data::Dump::Tree in community modules? i would like to submit a PR for it. 21:11
to try to make it work on macos 21:13
lucs Given a declaration like method baz (Int() $foo) , what do the parens after Int mean? 22:13
librasteve lucs: they specify that the argument should be coerced into the required type Int (if possible) 22:19
lucs Ah, I see. Thanks.
librasteve docs.raku.org/language/typesystem#Coercion
lucs Interesting. 22:21
librasteve m: sub baz (Str $foo) {say $foo}; baz 12; baz 'two'; 22:22
evalable6 (exit code 1) ===SORRY!=== Error while compiling /tmp/pLaIPHsaST
Calling baz(Int) will never work with declared signature (Str $foo)
at /tmp/pLaIPHsaST:1
------> sub baz (Str $foo) {say $foo}; <HERE>baz 12; baz 'two';
22:23
Raku eval Exit code: 1 ===SORRY!=== Error while compiling main.raku Calling baz(Int) will never work with declared signature (Str $foo) at main.raku:1 ------> sub baz (Str $foo) {say $foo}; ⏏baz 12; baz 'two';
librasteve m: sub baz (Str() $foo) {say $foo}; baz 12; baz 'two';
Raku eval 12 two
evalable6 12
two
lucs So about those parentheses, in the third "multi method" shown at docs.raku.org/type/DateTime#method_new, are the absent parentheses after the Int for $minute simply a typo?
librasteve in the 2nd example, Int 12 is coerced to Str
lucs Yep, gotcha. 22:24
librasteve hmmm - dunno 22:27
m: say <5/2>.Int 22:32
Raku eval 2
evalable6 2
librasteve For handling points in civil time, a DateTime object stores year, month, day, hour, minute (all Int), second (potentially fractional) 22:33
so my guess is that the Signature line Int() $hour, Int $minute, $second, is intended to disallow fractional $minute 22:34
but above my understanding 22:35
scullucs That makes sense, but I was wondering why the coercion wasn't applied for only $minute.
librasteve its a good question - sorry I am just guessing 22:36
must sleep 22:37
scullucs In that case, sleep well 🙂
librasteve g'night