🦋 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 inspection is still being worked out
Set by lizmat on 12 August 2021.
SmokeMachine_ m: say Match ~~ Associative # should Match do Associative? 00:17
camelia False
SmokeMachine_ I think that would make sense…
moon-child more broadly, should the class/role be in roast? There was a bug filed recently, native types were not doing some numeric roles 00:19
*class/role _hierarchy_ be in roast
moon-child I think people depend on many aspects of the hierarchy which may not currently be tested 00:20
moon-child m: say Associative.of; say Match.of 00:20
camelia (Mu)
No such method 'of' for invocant of type 'Match'
in block <unit> at <tmp> line 1
moon-child or, rather 00:21
m: say Associative.can('of'); say Match.can('of')
camelia (of)
()
SmokeMachine_ m: say “bla ble” ~~ /<ws>/ 00:29
camelia 「」
ws => 「」
SmokeMachine_ m: say (“bla ble” ~~ /<ws>/)<ws>
camelia 「」
SmokeMachine_ m: say (“bla ble” ~~ /<ws>/).keys
camelia (ws)
SmokeMachine_ It even has the .keys methods… 00:30
m: say (“bla ble” ~~ /<ws>/).values
camelia (「」)
SmokeMachine_ m: say (“bla ble” ~~ /<ws>/).kv 00:31
camelia (ws 「」)
SmokeMachine_ m: Match.^mro
camelia ( no output )
SmokeMachine_ m: say Match.^mro
camelia ((Match) (Capture) (Cool) (Any) (Mu))
SmokeMachine_ m: say “{ .^name } -> { ? .^can: “kv” } for Match.^mro 00:33
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in curly double quotes; couldn't find final '”' (corresponding starter was at line 1)
at <tmp>:1
------> 3me } -> { ? .^can: “kv” } for Match.^mro7⏏5<EOL>
SmokeMachine_ m: say “{ .^name } -> { ? .^can: “kv” }”for Match.^mro 00:34
camelia Match -> True
Capture -> True
Cool -> True
Any -> True
Mu -> False
SmokeMachine_ m: say “{ .^name } -> { ? .^find_method: “kv”, :local } for Match.^mro
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in curly double quotes; couldn't find final '”' (corresponding starter was at line 1)
at <tmp>:1
------> 3nd_method: “kv”, :local } for Match.^mro7⏏5<EOL>
SmokeMachine_ m: say “{ .^name } -> { ? .^find_method: “kv”, :local }” for Match.^mro 00:35
camelia Match -> True
Capture -> True
Cool -> True
Any -> True
Mu -> False
SmokeMachine_ m: say “{ .^name } -> { ? .^find_method: “keys”, :local }” for Match.^mro
camelia Match -> True
Capture -> True
Cool -> True
Any -> True
Mu -> False
gfldex lolibloggedalittle: gfldex.wordpress.com/2021/08/13/inequality/ 08:40
Altreus Quite in contrast to ==, eqv does a type check # this is surprising 09:47
eqv surely means equivalent 09:48
Shouldn't equivalence try harder to be true than equality?
saying that Int(1) is not equivalent to Rat(1) breaks English 09:49
lizmat from the doc: "This could be called an equivalence operator, and it will return True if the two arguments are structurally the same, i.e. from the same type and (recursively) contain equivalent values." 09:56
docs.raku.org/routine/eqv
it specifically shows: say 1 eqv 1.0; # OUTPUT: «False␤» 09:57
Altreus Yeah I think I'm questioning the 20 years of design instead of saying something constructive again 09:58
lizmat well... maybe there *is* a point to be made 09:59
fwiw, we now got more user experiences :-)
I'm just saying that changing anything in this area, would need a language version bump
Altreus I'm a big fan of the thing doing what I think the word means
lizmat m: dd 1 == 1.0 10:00
camelia Bool::True
lizmat now, whether you would call those equivalent...
Altreus I was rude about PHP having === but now I realise that was just me being rude about everything PHP did 10:01
I actually quite like it, in principle
Does raku keep P5's philosophy of == for numeric equality and eq for string equality? 10:02
lizmat yes
== numifies, eq stringifies
Altreus Thought so - when you remember that, eqv makes
lizmat m: say "42" == "42.0"
camelia True
Altreus oops, makes more sense to do what it does
cos what else are you gonna do? mimic PHP's or JS's stack of rules for how to apply ==? 10:03
The whole point of == and eq is to tell Raku how to treat it; if you don't tell it how to do the comparison it also has to compare type
gfldex: you spawned discussion :D 10:04
I note that Int and Rat are both Real and therefore siblings 10:05
cousins actually 10:06
gfldex I believe haveing a meta-op variant for ∈ and friends would actually solve the problem. 10:07
m: say 1/1 eqv 2/2; 10:10
camelia True
gfldex m: say 1 eqv 2/2;
camelia False
gfldex infix:<eqv> does the right thing. Sadly, the name doesn't fit to what it does. 10:11
Altreus ∈[==] like? 10:17
lizmat fwiw, I think that is mixing set semantics with something else 10:22
set semantics are not about comparisons, in my view 10:23
they are about applying some hashing function to values to see whether they are the same
currently, that's .WHICH
so, from the example, it should probably be something like ∈[Int] 10:24
you could also see the .WHICH as a coercion to an ObjAt object
Xliff \o 10:26
m: proto sub a (|c) { c<a>.gist.say; {*} }; multi sub a (:$i!) { $i.gist.say }; a(:a = 1, :i = <a b c>); 10:27
camelia Cannot modify an immutable Pair (i => True)
in block <unit> at <tmp> line 1
Xliff m: proto sub a (|c) { c<a>.gist.say; {*} }; multi sub a (:$i!) { $i.gist.say }; a(a = 1, i = <a b c>);
camelia 5===SORRY!5=== Error while compiling <tmp>
Preceding context expects a term, but found infix = instead.
Did you make a mistake in Pod syntax?
at <tmp>:1
------> 3ulti sub a (:$i!) { $i.gist.say }; a(a =7⏏5 1, i = <a b c>);
Xliff m: proto sub a (|c) { c<a>.gist.say; {*} }; multi sub a (:$i!) { $i.gist.say }; a(a => 1, i => <a b c>);
camelia 1
Cannot resolve caller a(:i(List), :a(Int)); none of these signatures match:
(:$i!)
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff m: proto sub a (|c) { c<a>.gist.say; {*} }; multi sub a (:$i!, *%c) { $i.gist.say }; a(a => 1, i => <a b c>); 10:28
camelia 1
(a b c)
Xliff m: proto sub a (|c) { c<a>.gist.say; {*} }; multi sub a (:$i!, :$a) { $i.gist.say }; a(a => 1, i => <a b c>);
camelia 1
(a b c)
Altreus lizmat: hadn't considered that perspective 10:39
Rather than are these equivalent according to this operation, it's are these equivalent after this conversion?
Altreus mind you, isn't that just ∈ map? 10:40
lizmat well, in practice they are eq after conversion
Altreus: yes, that would effectively be it :-)
m: dd 1 (elem) (1.0,)>>.Int 10:41
camelia Bool::True
Altreus I'm content to consider that the philosophy of set stuff 10:52
the set should contain things of the type you're comparing it to 10:53
lizmat m: my %s is Set[Int] = 1, 1.0 10:55
camelia Type check failed in binding; expected Int but got Rat (1.0)
in block <unit> at <tmp> line 1
lizmat m: my %s is Set[Int()] = 1, 1.0 # sadly, that doesn't work, yet anyway
camelia ( no output )
lizmat m: my %s is Set[Int()] = 1, 1.0; dd %s
camelia Set[Int(Any)].new(1.0,1)
gfldex We will never be able to coerce to Numeric. 11:01
Altreus we've always been at war with eqv 11:06
leont Oceania had always been at war with Eastasia 11:40
thundergnat Something I have pondered before, and with the Set coercion discussion, has again pushed to the forefront: Should .narrow coerce *Str to numeric? 12:25
m: my @l = < 3 3.0 3.1 3e0 3.1e0 >; say @l.map: *.narrow.^name; dd @l>>.narrow.Set# Since .narrow is a numeric operator, I would expect ("Int", "Int", "Rat", "Int", "Num")
camelia (IntStr Int RatStr Int NumStr)
Set.new(NumStr.new(3.1e0, "3.1e0"),IntStr.new(3, "3"),RatStr.new(3.1, "3.1"),3)
thundergnat Conversely, if it doesn't remove stringy characteristics from a *Str, why isn't there a Str candidate that just passes through the Str unchanged? 12:27
m: my @l = < 3 3.0 3.1 3e0 3.1e0 a >; say @l.map: *.narrow.^name;
camelia No such method 'narrow' for invocant of type 'Str'
in block <unit> at <tmp> line 1
thundergnat I don't really expect answers to these questions, just something I've pondered. 12:28
thundergnat Another point to ponder. What is narrower? A Rat or a Num? The docs for .narrow say "Returns the number converted to the narrowest type that can hold it without loss of precision." 12:43
I would argue that a Rat is better at not losing precision, at least up to the Rat/Num threshold.
thundergnat m: say 3.1.narrow.^name; say 3.1e0.narrow.^name; # Seems like they are considered "equal" in the precision heirarchy 12:45
camelia Rat
Num
lizmat weekly: www.theregister.com/2021/08/13/per...ignations/
notable6 lizmat, Noted! (weekly)
thundergnat Again, not expecting answers, just points to ponder. 12:46
[Coke] I don't quite understand the question based on the example. If you've got a Num, you can't narrow to the more precise Rat, can you? 12:50
thundergnat [Coke] Probably not. Raku only preserves precision to the default stringify display precision so we cant rely on conversions being exact. 12:57
m: my $n = 3.73389e0; say join ' ', $n, $n.^name, $n.Rat, $n.Rat.^name, $n.Rat.base(10,15);
camelia 3.73389 Num 3.73389 Rat 3.733890214797136
thundergnat You might expect 3.73389e0.Rat to be equal to 3.73389, but it isn't behind the scenes ^^^^ 12:59
[Coke] I assume .base is sending that through Num first because of your request for a specific number of digits. 13:40
(it DTRT if you leave off the 15)
me: gets handwavy. my coffee: spills all over my work area. 13:42
vrurg The more I observe the discussions about Perl's Cor, the more I it feels great that Perl6 syntax hasn't been kept backward compatible... 14:06
thundergnat [Coke] Naw, it's the whole "What Every Programmer Should Know About Floating-Point Numbers" showing up. Raku does a really good job of hiding that, so it's especially jarring when it _does_ show up. 16:13
m: say 3.73389e0.Rat.nude; say 3.73389.nude; 16:14
camelia (3129 838)
(373389 100000)
thundergnat m: say 3.73389e0.Rat.base(10,15); say 3.73389.base(10,15); 16:15
camelia 3.733890214797136
3.733890000000000
lizmat m: 42 666 16:49
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 03427⏏5 666
expecting any of:
infix
infix stopper
statement end
statement modifier
statement modif…
melezhik . 17:55
weekly: dev.to/melezhik/bird-raku-dsl-for-...sting-1hph
notable6 melezhik, Noted! (weekly)
lizmat m: for } a 18:04
camelia 5===SORRY!5=== Error while compiling <tmp>
Unexpected closing bracket
at <tmp>:1
------> 3for 7⏏5} a
lizmat m: say "\x03" ~ "5foobar" 18:09
camelia 5foobar
lizmat m: say "\x03" ~ "5foobar\x03" ~ "7barbaz" 18:09
camelia 5foobar7barbaz
lizmat m: say "\x03" ~ "5foobar\x03" ~ "7barbaz\x03" ~ 3green" 18:10
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3x03" ~ "5foobar\x03" ~ "7barbaz\x03" ~ 37⏏5green"
lizmat m: say "\x03" ~ "5foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia 5foobar7barbaz3green
lizmat m: say "\x03" ~ "1foobar\x03" ~ "7barbaz\x03" ~ "3green" 18:14
camelia 1foobar7barbaz3green
lizmat m: say "\x03" ~ "2foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia 2foobar7barbaz3green
lizmat m: say "\x03" ~ "3foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia 3foobar7barbaz3green
lizmat m: say "\x03" ~ "4foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia 4foobar7barbaz3green
lizmat m: say "\x03" ~ "5foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia 5foobar7barbaz3green
lizmat m: say "\x03" ~ "6foobar\x03" ~ "7barbaz\x03" ~ "3green" 18:15
camelia 6foobar7barbaz3green
lizmat m: say "\x03" ~ "7foobar\x03" ~ "7barbaz\x03" ~ "3green" 18:17
camelia 7foobar7barbaz3green
lizmat m: say "\x03" ~ "8foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia 8foobar7barbaz3green
lizmat m: say "\x03" ~ "9foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia 9foobar7barbaz3green
lizmat m: say "\x03" ~ "afoobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia afoobar7barbaz3green
lizmat m: say "\x03" ~ "foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia foobar7barbaz3green
lizmat m: say "\x03" ~ "0foobar\x03" ~ "7barbaz\x03" ~ "3green"
camelia 0foobar7barbaz3green
moon-child m: say "\x[03]11,4dual" 18:19
camelia 11,4dual
moon-child m: say "\x[02]bold\x[1d]italic\x[1f]underline" 18:20
camelia bolditalicunderline
lizmat oops, I thought I was doing this privately with Camelia :-( 18:21
lizmat wonder if anybody has a module to turn that into <span> s 18:25
lizmat m: for } a 18:41
camelia 5===SORRY!5=== Error while compiling <tmp>
Unexpected closing bracket
at <tmp>:1
------> 3for 7⏏5} a
Shaeto class foo is rw { ... } = has ?? is rw for all class attributes ? 19:50
moon-child m: class F is rw { has $.x }; F.new.x = 5 19:51
camelia ( no output )
moon-child seems so
Shaeto thank you, found this in wiki :) 19:52
w/o any exlanation 19:53
Geth Raku-Steering-Council/RSC_code: 96828ac873 | (Daniel Sockwell)++ | papers/Raku_Steering_Council_Code.md
Address minor nits
20:45