🦋 Welcome to the IRC channel of the core developers of the Raku Programming Language (raku.org #rakulang). This channel is logged for the purpose of history keeping about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | log inspection situation still under development | For MoarVM see #moarvm
Set by lizmat on 22 May 2021.
Geth roast: vrurg++ created pull request #754:
Add typecheck tests for natives
01:52
roast: 483bc49765 | (Vadim Belman)++ | S02-types/native.t
Add typecheck tests for natives

Make sure thay match against `Real`, `Numeric`, and `Stringy` roles.
02:02
roast: 9e4699bc26 | (Vadim Belman)++ (committed using GitHub Web editor) | S02-types/native.t
Merge pull request #754 from vrurg/rakudo_4485

Add typecheck tests for natives
gfldex m: say 1 ∈ (1/1, ); 08:36
camelia False
gfldex lizmat: is that ^^^ intentional? 08:37
lizmat gfldex: yes, as they are different types 08:39
m: say 1.WHAT; say (1/1).WHAT
camelia (Int)
(Rat)
gfldex That's a trap. 09:01
What could be solved by making set operators hyper operators. 09:02
∈== could DWIM 09:03
lizmat ?? 09:08
set operator purely work on the .WHICH what they're given 09:09
gfldex: now with DWIM, one could argue that: 09:10
m: my %s is Set[Int()] = 42, 42e0; dd %s
camelia Set[Int(Any)].new(42,42e0)
lizmat should result in a Set with just 42 in it 09:11
and indeed, I would consider this a bug...
m: my %s is Set[Int] = 42, 42e0; dd %s
camelia Type check failed in binding; expected Int but got Num (42e0)
in block <unit> at <tmp> line 1
gfldex m: say 1 ∈ (1/1, )».Int; 09:12
camelia True
lizmat that would also work, yes
gfldex That works too. However, in real code it is very easy to have a Num or num sneak in without noticing. 09:13
And when using ∈ both operands need to be of the same type. Right now that silently fails by becomming False. 09:14
lizmat in your example, the operands are *not* of the same type: one is an Int, and the other is a List
the semantics are clear: 1 ∈ (1/1, ) is just short for 1 ∈ (1/1, ).Set 09:15
m: dd (1,1/1).unique 09:16
camelia (1, 1.0).Seq
lizmat same there
gfldex They are indeed not the same type. Since it is easy to get there, I consinder this a trap.
I stepped into that one when trying to use Set in github.polettix.it/ETOOBUSY/2021/0...n-triples/ 09:17
lizmat maybe a doc PR is in order then :-)
fwiw, I have considered creating optimized versions of Set[int] Set[Int] Set[str] at one point 09:18
and now, with the new coercion protocol: 09:19
Set[int()] Set[Int()] Set[str()]
Xliff \o 10:27
Is there an analog to ^add_method but for subroutines in raku?
lizmat you can only add subs to a scope at compile time, afaik 10:30
but you *can* add a stub: and set that at runtime
Xliff lizmat++: That's fien. How is that accomplished.
lizmat m: my &foo; &foo = *-1; say foo(43)
camelia 42
lizmat actually one of the examples in my sigils talk 10:31
Xliff So I guess the best way to accomplish what I want is in sub EXPORT {} 10:32
How can I must changer what EXPORT normally will export without affecting the existing work already done by "is export"?
I guess it boils down to "is there a way to mess with the EXPORT table without using sub EXPORT"? 10:33
lizmat www.youtube.com/watch?v=pvDZUlNHGCw&t=988s
Xliff Thanks!
Very nice! What software was used to make the presentation? 10:35
lizmat make sure you also export all of the symbols in EXPORT::DEFAULT 10:36
Xliff: Keynote
Xliff Thanks!
Awww... It's for Apple! 10:37
Now I need a VM! :)
Is there a Raku equivalent of "Rakudo::Internals.EXPORT_SYMBOL(nqp::decont($SYMBOL), @tags, $to_export);"? 10:57
Or can such a thing be done via nqp?
lizmat what are you trying to accomplish? 11:05
Xliff lizmat: Adding to the export table where I don't have to redeclare the entire Map. 11:06
Wait one.
lizmat you can also return a Hash, no? and just add to that? 11:07
just make sure the values are *bound* to the keys, otherwise you may get containers that you don't want
Xliff gist.github.com/Xliff/a09d103689cd...d63fa905bb 11:12
There is no easy way to bind with the existing initializer, right?
Addding "is export" back to the routines in the package will allow them to export properly. 11:17
Once you comment out their definitions in sub EXPORT
However the aliases still do not work correctly.
lizmat why do you put the subs in a package? why not just in the mainline? 11:18
Xliff: how about just 'our sub postfix:<minutes>($) { ... }; our constant &postfix:<m> = &postfix:<minutes>;' 11:24
no need for EXPORT or anything
the "our" will take care of the export
the "constant" will do the aliasing
m: sub postfix:<!>($) { 42 }; say 666! 11:26
camelia 42
lizmat m: sub postfix:<!>($) { 42 }; say 666 !
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3sub postfix:<!>($) { 42 }; say 6667⏏5 !
expecting any of:
infix
infix stopper
postfix
statement end
stateme…
lizmat there's no whitespace allowed for postfix
and that gets you into trouble when using an alphabetic postfix operator 11:27
or not?
Xliff lizmat++: HAH! Yeah. That would have worked.
lizmat m: sub postfix:<m>($) { 42 }; say 666m
camelia 42
lizmat hmmm
anyways, works for constants, but not for variables 11:28
m: sub postfix:<m>($) { 42 }; my $a = 666; say $am
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$am' is not declared
at <tmp>:1
------> 3ostfix:<m>($) { 42 }; my $a = 666; say 7⏏5$am
lizmat s/constants/literals
m: sub postfix:<minutes>($) { 42 }; my $a = 666; say ($a)minutes # workaround 11:29
camelia 42
Geth rakudo/master: 4 commits pushed by raydiak++, (Elizabeth Mattijsen)++ 16:17
Geth roast/add-test-for-2920: 11504534e5 | Altai-man++ (committed using GitHub Web editor) | S03-sequence/misc.t
Clarify the test to cover a more narrow behavior

  @vrurg++ for investigating and suggesting a better way to do this.
20:02
Geth roast: e8e0028c6b | Altai-man++ | S03-sequence/misc.t
Add test for #2920
20:38
roast: 11504534e5 | Altai-man++ (committed using GitHub Web editor) | S03-sequence/misc.t
Clarify the test to cover a more narrow behavior

  @vrurg++ for investigating and suggesting a better way to do this.
roast: 9c141b4788 | (Vadim Belman)++ (committed using GitHub Web editor) | S03-sequence/misc.t
Merge pull request #747 from Raku/add-test-for-2920

Add test for #2920
URI: d3012a55fa | (David Warring)++ | 13 files
rename sources *.pm -> *.rakumod
20:45
URI: 1acf17a449 | (David Warring)++ | 4 files
give URI::Path and URI::Query their own compilastion units
URI: ffa2c224f6 | (David Warring)++ | .github/workflows/test.yml
set up github test CI
roast: 96d879a2f7 | Altai-man++ | S03-metaops/misc.t
Add test for #1890
21:04
roast: 48531b6c6b | (Vadim Belman)++ (committed using GitHub Web editor) | S03-metaops/misc.t
Merge pull request #749 from Raku/add-test-for-1890

Add test for #1890
Geth URI: 62da4625f9 | (David Warring)++ | 2 files
tweak absolute() and relative() deprecation
22:37