🦋 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.
00:02 habere-et-disper left
[Coke] there's no self during the end. if you save it into a lexical, that might work. 00:07
00:07 reportable6 left
[Coke] not sure why it would work in non-first runs. 00:07
00:07 reportable6 joined
[Coke] ... I mean, assuming my guess is right. 00:07
00:18 derpydoo joined
tonyo Is it being precomped? 01:06
01:16 MasterDuke left, synthmeat left, dogbert11 left, rypervenche left, tejr left, kaskal left, Tirifto_ left, oodani left, human_blip left, mtj left, kybr left, a3r0 left, gfldex left, kaskal joined, oodani joined, synthmeat joined, a3r0 joined 01:17 dogbert11 joined, rypervenche joined, rypervenche left, rypervenche joined, mtj joined, Tirifto joined 01:18 human_blip joined, derpydoo left 01:21 tejr joined 01:26 gfldex joined 01:30 deoac joined
deoac ``` 01:30
my Rat $r = 1.0;
my Int $i = 1;
try $i = $r;
say $! if $!;
try $r = $i;
say $! if $!;
#OUTPUT:
#Type check failed in assignment to $i; expected Int but got Rat (1.0)
# in block <unit> at deleteme.raku line 5
#
#Type check failed in assignment to $r; expected Rat but got Int (1) 01:31
# in block <unit> at deleteme.raku line 7
```
Why aren't Ints coerced into Rats?
guifa Assignment doesn't automatically coerce in Raku (unless you have a coercion type) 01:37
So you could do, for instance 01:38
m: my Rat() $r = 1.0; my Int $i = 1; $r = $i; say "r is $r and is a ", $r.WHAT; 01:39
camelia r is 1 and is a (Rat)
01:47 MasterDuke joined 02:01 deoac left, deoac joined, HvszrStykp joined
deoac Thanks, I didn't know about the Int() syntax. 02:01
But the question remains, why aren't Ints automatically coerced to Rats?  It's certainly DWIM. 02:02
02:03 kybr joined
MasterDuke raku is strongly typed and they're different types 02:04
they can coerce if you request that, but it doesn't happen automatically 02:05
m: say Int.^mro; say Rat.^mro 02:07
camelia ((Int) (Cool) (Any) (Mu))
((Rat) (Cool) (Any) (Mu))
02:41 frost joined 02:55 razetime joined 03:04 bigdata joined 03:07 deoac left 03:17 Oshawott joined 03:21 archenoth left 03:48 razetime left 03:55 bigdata left 04:17 HvszrStykp left 04:27 [Coke]___ joined 04:29 [Coke] left 04:37 razetime joined 04:40 cm left, cm joined 05:18 razetime left 05:32 Kaiepi left 05:33 Xliff joined
Xliff gist.github.com/Xliff/69b7bccf1f74...e27abe8657 05:34
\o
tellable6 2022-10-05T11:00:55Z #raku <gfldex> Xliff gist.github.com/b1a3eb9f870cb7c6af...63f2fa2a80
05:47 razetime joined 06:08 reportable6 left 06:09 reportable6 joined 06:22 abraxxa joined, HvszrStykp joined 06:24 abraxxa left 06:26 abraxxa joined 06:30 abraxxa left 06:31 abraxxa joined 06:42 gfldex left, human_blip left, rypervenche left, dogbert11 left, a3r0 left, vrurg left, silug left, dustinm` left, ilogger2 left, perlmaros left, bdju left, a3r0 joined, perlmaros_ joined 06:43 rypervenche joined, dogbert11 joined, silug joined, perlmaros_ is now known as perlmaros, rypervenche left, rypervenche joined, vrurg joined 06:44 bigdata joined 06:45 dustinm` joined 06:46 human_blip joined 06:47 ilogger2 joined 06:48 bdju joined 06:52 gfldex joined 07:20 lichtkind joined 07:29 Sgeo left
Kernspin Good morning. 07:52
Nemokosch sup 07:53
08:03 razetime left 08:07 dakkar joined 08:20 razetime joined 08:54 Kaiepi joined
lizmat hythm: END try self.some-method() 09:30
tellable6 lizmat, I'll pass your message to hythm
Nemokosch deoac: the point you went down from the track of DWIM was when you assigned a self-declared Int to a self-declared Rat. Basically, you were the one who explicitly asked it to fail 09:44
09:44 Kaiepi left
I'm often under the impression Raku type annotations weren't meant for what people are trying to use them 09:46
And this is the rare case where I think people could be "fixed" instead of the language
ironically enough, the type annotation could rightfully claim "I do what I mean", as in meaning 09:48
09:50 Kaiepi joined 09:53 habere-et-disper joined 09:55 zups joined 10:05 Kaiepi left
guifa There's a reason Real and Numeric types exist, fwiw 10:06
Those are broader and will take Rats and Ints alike
10:08 habere-et-disper left
Xliff \o 10:10
gist.github.com/Xliff/69b7bccf1f74...e27abe8657
Nemokosch The naming of types could be better, if anything, Real being "outside" of Num 10:14
10:15 Kaiepi joined 10:16 holyghost left, sena_kun joined
Xliff: what does `does` do, and are you sure it shouldn't be `but`? 10:23
both are absolute magic to me tbh
lizmat Nemokosch: do you grok roles ? 10:32
tellable6 lizmat, I'll pass your message to Nemokosch1
Nemokosch Nemokosch1 is back... 10:46
lizmat: no, I don't think so 10:51
lizmat and you've read docs.raku.org/language/objects#Roles ?
in any case, you could think of "does" as the "but-rw" version of "but" 10:53
a does b is sorta like a = a but b
Nemokosch I only read it superficially. Honestly, the time just hasn't come when it's useful for me. 10:58
lizmat have you used inheritance in classes, and where annoyed by its deficiencies ? read up on roles :-) 10:59
*were
tbrowder .tell tonyo i'm not yet using yr code as basis for formatter, the trick is getting two or more different formatters in the same program that actually work with DateTime to produce, e.g., "2022-10-11T00:00:00 CST" or "2023-06-01T00:00:00 CDT". i can do that with my hack, but can't with yrs. 11:05
tellable6 tbrowder, I'll pass your message to tonyo
Nemokosch I'm pretty sure HTML::Tag itself uses roles but I haven't needed to alter them much yet 😄 11:07
11:14 labster left
tbrowder melezhik: i just added a feature request for Cromtit 11:24
tellable6 tbrowder, I'll pass your message to melezhik
tonyo tbrowder: do you have a usage or repo I can peek at? 11:25
tellable6 hey tonyo, you have a message: gist.github.com/288f3ee903a034bcd1...5eba5d6f43
11:47 frost left 11:54 habere-et-disper joined 12:07 reportable6 left, reportable6 joined 12:17 Kaiepi left, Kaiepi joined 12:21 [Coke]___ is now known as [Coke] 12:23 derpydoo joined 12:35 epony left 12:38 bigdata left
tbrowder tonyo: yes - github.com/tbrowder/LocalTime/ 12:39
12:39 lizmat_ joined 12:42 RakuIRCLogger joined 12:43 lizmat left 12:47 RakuIRCLogger left, RakuIRCLogger joined
Xliff Did anyone get the chance to look at my gist? 13:28
Or can tell me how I can get values from a Parameter object? 13:29
lizmat_ Parameter.get_value ? 13:30
13:30 lizmat_ is now known as lizmat
Xliff lizmat: Can you tell me why my gist doesn't work? 13:30
lizmat not without looking deeper into it, and I need to go afk in a few minutes
will look into it when back in a few hours 13:31
Xliff lizmat: Isn't that Attribute.get_value?
13:31 abraxxa left
Xliff lizmat: *sigh* -- OK, thanks. 13:31
lizmat ah.. yes...
oops, you're right
Xliff :)
lizmat hmmm. off the top of my head, there's no interface to the Parameter object to do that 13:32
Xliff Ah. Why not? 13:33
I guess I can see why, though.
I'd like to write a Parameter::Also
The existing syntax is bothering me. :)
lizmat creating Method::Also originally was just syntactic sugar for .^add_method 13:34
so there was metamodel support for it
Xliff I know. We've had that conversation, I think. :)
lizmat could well be :-) 13:35
Xliff I was hoping that all I needed to do was override Parameter.named_names, but that turns out to not be the case.
I guess I'll delve into the source if I get some time today. Thanks. 13:36
lizmat could be just named_names, but at compile time 13:37
13:37 razetime left
Xliff Aren't traits done at compile time? 13:37
lizmat true
afk&
13:45 dogbert11 left
vrurg Xliff: a lot of work is done by parameter binding code. Not sure how does aliasing work, I was mostly focusing on different things. But I could guess it's not using metamodel. 13:58
14:01 jgaz joined
vrurg Xliff: yep, that's the case. Grep for named_names through Actions.nqp. It's not using parameter's object. 14:23
tbrowder tonyo: check my prog in the dev directory: tonyo-v2.raku
that's where i started experimenting with your lag 14:24
*latest
14:24 Sgeo joined 15:01 razetime joined
[Coke] updated to HEAD recently, ran a script on windows, got a segfault. 15:03
will see if I can track it down.
15:05 melezhik joined
melezhik o/ 15:05
tellable6 2022-10-12T11:24:04Z #raku <tbrowder> melezhik: i just added a feature request for Cromtit
melezhik .tell tbrowder - cool! - github.com/melezhik/Cromtit/blob/m...che-server
tellable6 melezhik, I'll pass your message to tbrowder 15:06
tbrowder melezhik: hi, thnx, gotta go, bye 15:07
melezhik tbrowder , sure, thanks again!
15:13 Colere is now known as Sauvin 15:18 epony joined 15:23 melezhik left 16:07 derpydoo left
[Coke] segfault was occuring loading an old .precomp :( 16:13
I removed the .precomp dir in question, script started working again
wish I had saved the old directory for diagnostics, sorry. 16:14
is a newer version of rakudo enough to trigger re-compilation? (if so, is it just when the bytecode format changes, or when a version is released, or...) 16:16
16:36 dakkar left
tonyo tbrowder: should this be converting the time to the right timezone? 16:38
tbrowder no, i take care of that. just handle various text inputs that go after the time string. they are constant strings inside the formatter. 16:47
tonyo tbrowder: gist.github.com/tonyo-tatari/2c567...8651d62ae9
16:50 haxxelotto joined 16:51 sena_kun left 16:58 haxxelotto left 16:59 derpydoo joined 17:14 derpydoo left 17:16 habere-et-disper left 17:20 derpydoo joined 17:30 haxxelotto joined
tbrowder look at my method gen-fmt-class 17:35
17:47 dextercd joined 17:50 razetime left 18:03 TieUpYourCamel left 18:06 reportable6 left 18:09 reportable6 joined
tonyo I see, I'll modify for that ^ 18:13
18:16 TieUpYourCamel joined
ugexe [Coke]: should be, but yeah for some reason deleting the precomp folder fixes things for unknown reasons 18:48
i often think it might be related more to runtime module loading but i dont really have any proof of that
[Coke] Thanks 18:58
19:16 linkable6 left, evalable6 left, sftp left, sftp joined 19:18 linkable6 joined, evalable6 joined 19:34 lizmat left 19:35 lizmat joined
ugexe m: my %*SUB-MAIN-OPTS = :allow-no; sub MAIN(:$foo, :$no-foo) { say $foo; say $no-foo }; BEGIN @*ARGS = <--foo --no-foo>; 19:55
camelia [True False]
(Any)
ugexe why im not a fan of having all these MAIN options
Nemokosch what is this SUB-MAIN-OPTS at all? 19:57
ugexe it changes the parsing of sub MAIN. it also pretty much guarantees the current implementation can never be replaced due to so much of the tacked on functionality not having much cohesiveness or or consistency 19:58
our descendants will use `sub MAIN2 {...}` 20:02
Nemokosch maybe in version 7 😂 20:03
ugexe i though larry said there couldnt be a version 7 because that would imply it was perfect or some such
Nemokosch and they will never know where that 2 came from
like X11, forever 11 20:05
ugexe: fair point; guess that's why Perl5 folks had to back up from releasing Perl 7
on a more serious tone: I personally think that it's hard to further improve the situation around CLI argument parsing - simply because it's superior to everything I have seen or heard of 20:08
ugexe m: sub MAIN(Str :$mystr) { say so $mystr; say $mystr }; BEGIN @*ARGS = <--mystr=False> 20:10
camelia Usage:
<tmp> [--mystr=<Str>]
ugexe like i cant think of a single situation where someone wants to pass a boolean false as the string "False" 20:11
m: sub MAIN(Str :$mystr) { say so $mystr; say $mystr }; BEGIN @*ARGS = <--mystr=FalseXXX>
camelia True
FalseXXX
Nemokosch I have seen this with enums 20:13
more precisely: `Label` failed to be parsed as an enum value because of the existing `Label` class 20:14
ugexe its at least consistent in its own way. afterall is --mystr=1 an in or a str?
int or a str^
but beyond numerical stuff it doesn't seem useful
Nemokosch Is there even a way to force passing False as a string? 20:17
ugexe m: my %*SUB-MAIN-OPTS = :coerce-allomorphs-to(Str); sub MAIN(Str :$mystr) { say so $mystr; say $mystr }; BEGIN @*ARGS = <--mystr=False> 20:20
camelia Usage:
<tmp> [--mystr=<Str>]
ugexe i would intuitively expect that to do so, but obviously doesnt
m: my %*SUB-MAIN-OPTS = :coerce-allomorphs-to(Version); sub MAIN(Str :$mystr) { say so $mystr; say $mystr }; BEGIN @*ARGS = <--mystr=False> 20:22
camelia Unsupported allomorph coercion: Version
in block <unit> at <tmp> line 1
ugexe i guess because string "False" is a bool, not an allmorph of False|"False" 20:23
which seems inconsistent 20:24
20:25 Nemokosch joined
ugexe but an Allmorph of boolean False and string "False" would make no sense outside of dispatching for MAIN 20:25
Nemokosch m: enum Element<Entity Label>; sub MAIN(Element :$choice) { dd $choice; }; BEGIN @ARGS = <--choice=Label> 20:27
camelia ===SORRY!=== Error while compiling <tmp>
Variable '@ARGS' is not declared. Perhaps you forgot a 'sub' if this
was intended to be part of a signature?
at <tmp>:1
------> lement :$choice) { dd $choice; }; BEGIN ⏏@ARGS = <--choice=…
tellable6 2022-10-12T10:32:16Z #raku <lizmat> Nemokosch: do you grok roles ?
Nemokosch oops copypaste fail 20:28
m: enum Element<Entity Label>; sub MAIN(Element :$choice) { dd $choice; }; BEGIN @*ARGS = <--choice=Label>
camelia Usage:
<tmp> [--choice=<Element> (Entity Label)]
Nemokosch m: enum Element<Entity Label>; sub MAIN(Element :$choice) { dd $choice; }; BEGIN @ARGS = <--choice=Entity>
camelia ===SORRY!=== Error while compiling <tmp>
Variable '@ARGS' is not declared. Perhaps you forgot a 'sub' if this
was intended to be part of a signature?
at <tmp>:1
------> lement :$choice) { dd $choice; }; BEGIN ⏏@ARGS = <--choice=…
Nemokosch aaaa
m: enum Element<Entity Label>; sub MAIN(Element :$choice) { dd $choice; }; BEGIN @*ARGS = <--choice=Element>
camelia Usage:
<tmp> [--choice=<Element> (Entity Label)]
Nemokosch It's ridiculous that I just can't get this right
m: enum Element<Entity Label>; sub MAIN(Element :$choice) { dd $choice; }; BEGIN @*ARGS = <--choice=Entity> 20:29
camelia Element::Entity
Nemokosch so yes, eventually I succeeded at reproducing it...
let's try with Array instead of Label 20:30
m: enum Element<Button Array>; sub MAIN(Element :$choice) { dd $choice; }; BEGIN @*ARGS = <--choice=Array> 20:31
camelia Usage:
<tmp> [--choice=<Element> (Array Button)]
Nemokosch m: enum Element<Button Array>; sub MAIN(Element :$choice) { dd $choice; }; BEGIN @*ARGS = <--choice=Button>
camelia Element::Button
Nemokosch same thing
20:31 Nemokosch left 20:32 derpydoo left 21:32 sourceable6 left, bloatable6 left, unicodable6 left, notable6 left, quotable6 left, shareable6 left, reportable6 left, squashable6 left, benchable6 left, linkable6 left, tellable6 left, committable6 left, bisectable6 left, releasable6 left, evalable6 left, nativecallable6 left, greppable6 left, statisfiable6 left, coverable6 left, greppable6 joined, unicodable6 joined, coverable6 joined, statisfiable6 joined 21:33 sourceable6 joined, releasable6 joined, shareable6 joined, benchable6 joined, quotable6 joined, linkable6 joined, committable6 joined, notable6 joined 21:34 squashable6 joined, evalable6 joined, nativecallable6 joined 21:35 tellable6 joined, reportable6 joined, bisectable6 joined, bloatable6 joined 21:38 haxxelotto left 21:49 lichtkind left
[Coke] I once worked in a language where the country code "NO" was interpreted as False. 22:05
guifa lol 22:07
Xliff vrurg: Thanks for the update. How does parameter binding occur? 22:10
vrurg Xliff: see lower_signature in Actions. 22:11
Xliff vrurg: That one is ... quite large. 22:18
I do see that it's a hash, however.
vrurg Should be possible to replace with Param object though. 22:19
It is being used in some locations of the sub.
Xliff Hmmm... good thought. I'll make a note of it. 22:20
Actually, I'll look at the rakuast branch of this and see what's going on there, too. 22:21
lizmat weekly: dev.to/lizmat/dont-fear-the-grepper-1-1k3e 22:34
notable6 lizmat, Noted! (weekly)
lizmat afk&
22:38 jgaz left 22:41 dextercd left 22:56 Kaiepi left 22:59 Kaiepi joined, Kaiepi left, Kaiepi joined
[Coke] lizmat: you have an extra \ in one of the snippets as \* 23:16
er, \* %% 2
23:51 guifa_ joined 23:54 guifa left 23:55 jgaz joined