»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
rouking How do I pass each element in an array as a separate argument to a subroutine? e.g. `my @args = 'arg1', 'arg2'; my-sub(???)` 01:19
(the arity of the subroutine is unknown at compile time) 01:20
ugexe my-sub(|@args)
rouking Aha 01:21
I knew I had seen some easy way somewhere
thanks
Geth doc: 5282c57cfb | (Will "Coke" Coleda)++ | xt/code.pws
learn new code
02:26
piojo Did the way the REPL interacts with the terminal change recently? Some time in the past month, the REPL stopped working in cygwin and msys 06:38
it's still fine in cmd.exe, and cygwin/msys can still run "perl6 -e ..."
And using rlwrap doesn't help. 06:39
lizmat clickbaits p6weekly.wordpress.com/2017/09/11/...ng-sorted/ 07:31
jast nice title
piojo When compiling rakudo, is there any automatic way to choose a correct revision of NQP to build against? 08:23
pmurias samcv: I think I'll just implement how I want to nqp::unipropcode to work on the js backend and once stuff works there we can think how that stuff should work on MoarVM 08:42
yoleaux 11 Sep 2017 13:40Z <samcv> pmurias: i am going to sleep now. i'll talk with you more about this tomorrow. looks like you got disconnected, but check the log for my full response
daxim I am sad that I got ignored and my hopes were disappointed irclog.perlgeek.de/perl6/2017-04-04#i_14372592 09:13
samcv ok pmurias. so is it going to work for Property names themselves + General Category + Script values? 10:21
plus unions like Letter for Ll and Lo and Lu 10:22
samcv that is what I think it should do at least 10:22
pmurias samcv: nope, we need one for property names only 10:45
Even for unimatch do we want to allow unimatch('A', 'Latin', 'English') as a way to match Latin? 10:46
samcv that wouldn't match since there is no english property 10:48
samcv pmurias, but that is fine by me if you do that. :) totally fine with there being an op which specifically only does properties 10:49
lizmat daxim: would you care to elaborate ? 10:55
daxim I hoped to be able to do <paste.debian.net/925841/> after the grant in perl6 10:58
lizmat isn't that more what :ignoremark is supposed to do ? 11:06
timotimo #moarvm 11:08
er
daxim not quite 11:10
p6: 'Ə' ~~ m:ignoremark/E/
camelia ( no output )
daxim the magic is in the amended table 11:11
samcv it's not an E though 11:26
it's classified as a different distinct letter than E is
in unicode collation algorithm
Skarsnik let watch my vps die as I update 2 version of debian stable 11:26
samcv m: for <PRIMARY SECONDARY TERTIARY> { for <E Ə> -> $e { say $e, ' ', $e.uniprop("MVM_COLLATION_$_") } 11:27
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3e, ' ', $e.uniprop("MVM_COLLATION_$_") }7⏏5<EOL>
lizmat blogs.perl.org/users/lichtkind/2017...erl-6.html
samcv m: for <PRIMARY SECONDARY TERTIARY> { for <E Ə> -> $e { say $e, ' ', $e.uniprop("MVM_COLLATION_$_")} }
camelia E 7441
Ə 7460
E 33
Ə 33
E 9
Ə 9
Skarsnik what is collation btw? x) 11:28
samcv string sorting 11:29
with the unicode collation algorithm you can sort things in a basically codepoint number agnostic way
Skarsnik fun ^^ 11:30
I am curious what kind of people use the unicode stuff x)
samcv m: use experimental :collation; dd <æ a ae af fi fi fe fn ff>.collate
camelia ("a", "ae", "æ", "af", "fe", "ff", "fi", "fi", "fn").Seq
samcv m: use experimental :collation; dd <æ a ae af fi fi fe fn ff>.sort
camelia ("a", "ae", "af", "fe", "fi", "fn", "æ", "ff", "fi").Seq
samcv compare
m: use experimental :collation; dd <æ a á ā A Á Z r t u v>.collate 11:31
camelia ("a", "A", "á", "Á", "ā", "æ", "r", "t", "u", "v", "Z").Seq
samcv diacritics sort properly too
and it can also assinn multiple collation values to single codepoints, or assign single collation values to multiple codeponits
so æ sorts right after 'ae' 11:32
because it has two collation array elements
and ff has two as well, so sorts with ff
① will sort after 1 as well. and punctuation will sort together. so instead of sorting by codepoint it sorts in human ways 11:33
and i also allow you to configure each level
Skarsnik, read docs.perl6.org/language/experiment...ion_Levels the last section #Collation Levels 11:34
scovit please correct me if I am wrong: it is a well known fact that multi-dispatch don't work with native types? 11:36
samcv which native types?
but it should work 11:37
i've used separate ones for int and Int before
though i haven't tried every one. str and int work at least
lizmat m: multi sub a(int $a) { "int" }; multi sub a(Int $a) { say "Int" }; say a 42 # counter-intuitive maybe ? 11:38
camelia int
lizmat hmmm... I seem to recall that would call the Int candidate
timotimo right, we had a change for that a month or three ago
the case you have there is where the optimizer is able to figure it out 11:39
and the optimizer knows the difference between a literal and "just" a value
samcv releasable6, status
releasable6 samcv, Next release in 4 days and ≈7 hours. 1 blocker. Changelog for this release was not started yet
samcv, Details: gist.github.com/206158483d98fc98be...c3390364d5
scovit m: multi a(int \m, int \n) { say m }; multi a(Str $uno) { say $uno }; say a 3, 1; # is it expected?
camelia Cannot resolve caller a(Int, Int); none of these signatures match:
(int \m, int \n)
(Str $uno)
in block <unit> at <tmp> line 1
scovit m: multi a(Int \m, Int \n) { say m }; multi a(Str $uno) { say $uno }; say a 3, 1; # is it expected?
camelia 3
True
samcv cool will be able to get the collation stuff, and get in fixing case changes and ignoremark when there's prepend characters to the release
jnthn scovit: Yes 11:40
samcv plus all the huge string speed improvements :)
jnthn scovit: A native multi can only be reliably called when the operands are stored in natively typed variables 11:41
scovit jnthn good, thanks
jnthn scovit: As a convenience, for multi subs only (because that's the only case we can analyze statically), when one argument is a literal and the other is declared as natively typed, we'll turn the literal into a native also 11:42
Otherwise you'd not be able to write $native-int + 1
So we allow the literal to be allomorphic, but only if there's a known native
lunch & 11:43
samcv oh wow rakudo has no ordbaseat op. we need an op that does the same thing 12:02
to find the base codepoint or character in a certain string. or converts the whole string to base characters
both maybe hm
like substr but with returning the base codepoint 12:03
timotimo you can turn "the whole string" that you get from substr($foo, $n, 1) into base characters and grab the first one
[Coke] .tell piojo - if you use rakudo's Configure.pl --gen-nqp it will automatically insure you have the appropriate version of nqp available. (it won't update if it finds a version that is new enough) 12:10
yoleaux [Coke]: I'll pass your message to piojo.
scovit trait 'is pure' is for compile-time execution. What would be the opposite, e.g. enforcing runtime execution at least in module compilations? 12:35
where runtime execution is delayed execution
problem is with a nativecall which get executed at compiletime, but whish I do not wish that it does so because of the untrackable side effects 12:36
jnthn How are you ending up with it called at BEGIN time anyway? 12:38
It'd have to appear in a constant or BEGIN or trait argument or similar for that to happen
So the answer would be "don't do that" 12:39
scovit ok, it is in a constant.. right
basically I was forcing it to do so 12:40
jnthn constant means "at BEGIN time"
If you don't want something to happen then, don't use constant.
Skarsnik hm constant are compile time for module?
jnthn Yes 12:41
So once it's precompiled, that compuation doesn't have to happen again
Skarsnik but BEGIN in a module is run evertime you load the module?
jnthn No
It's ran when the module is compiled
b2gills If you want something that seems like it is a constant textually, you could use `sub term:<foo> () { (42,'bar').pick }`
jnthn INIT is run every time you load the module
scovit jnthn it is a defect of the module I uploaded last week (NativeHelpers::CBuffer). If you assign it to a constant in a module is gonna be SEGFAULT. Is there a way to detect this condition? 12:53
in order to bailout
jnthn Hmm
What that really means I guess is "check if the compiler is in dynamic scope" 12:54
I can't off-hand thing of a standard way to do that 12:55
A total cheat way is probably
scovit the module is a cheat already
jnthn m: say defined $*W; 12:55
camelia False
jnthn m: BEGIN say defined $*W;
camelia 1
jnthn So you can use truth of defined($*W) to know the compiler is running. It's Rakudo specific, but at least if someting changes it'd degrade into the same situation as without it 12:56
scovit I think it is ok for now
Geth doc: 592c43b7ff | MasterDuke17++ (committed using GitHub Web editor) | doc/Language/performance.pod6
Add column name to SQL profile example
12:57
[Coke] jnthn: should I be annoyed that it's False and 1? :)
jnthn No 12:59
sub defined delegates to .defined and $*W is an NQP object, not a Perl 6 one
And NQP doesn't have real booleans
pmurias what font should I use in my terminal that can display weird unicode charaters 13:15
pmurias ? 13:17
ilmari[m] Install Symbola, and it should fall back to that for characters not in your main font 13:19
MasterDuke i think Noto has a lot of the unicode symbols 13:23
scovit jnthn $*W seems to be always there during module loading 14:20
m: class ore { method new(Int $a) { if ($*W) { my $block := { self.new($a + 1); }; $*W.add_object($block); $*W.add_phaser(Mu, "INIT", $block, class :: { method cuid { (^2**128).pick }}); } else { say $a; return $a; }; } }; constant b = ore.new(1);
camelia 2
scovit would be possible to bind the output of the INIT phaser to b? 14:21
m: class ore { method new(Int $a) { if ($*W) { my $block := { self.new($a + 1); }; $*W.add_object($block); $*W.add_phaser(Mu, "INIT", $block, class :: { method cuid { (^2**128).pick }}); } else { say $a; return $a; }; } }; constant b = ore.new(1); say b
camelia 2
No such method 'gist' for invocant of type 'QAST::Op'. Did you mean any of these?
isa
list

in block <unit> at <tmp> line 1
jnthn scovit: Yeah, it will be 14:24
jnthn Since the compiler is loading the module as a result of compiling the script that uses it 14:25
scovit yea, I was guessing so
ruoso___ So, in my quest to write a fortran parser, I need to be able to parse statement labels... gist.github.com/anonymous/45bc0452...572968e895 is what I have come up with, but I wonder if there's a less terrible way of writing it... 14:53
ruoso___ oh, shoot... that's actually wrong... statement labels can also have spaces in the middle of the number... 14:56
ruoso___ so, that means the rule can actually be simpler... 14:57
moritz ruoso___: if it weren't for the rule change, you could have implemented that as .**6 & [' '* \d+ ' '*] 14:58
so a sequence of spaces, digits, spaces that is also 6 characters long
ruoso___ oh, neato
Didn't know about that feature 14:59
moritz or of course use an assertion, <?{ $<somecapture>.chars == 6 }>
& is very useful on some cases
another use case is "a quoted string that doesn't contain an x"
<quoted_string> & <-[x]>* 15:00
ruoso___ nice
scovit m: use nqp; class ore { method new(Int $a) { if ($*W) { my $block := { nqp::bindkey(CALLER::, "b", self.new($a + 1)); }; $*W.add_object($block); $*W.add_phaser($/, "INIT", $block, class :: { method cuid { (^2**128).pick }}); } else { say $a; return $a; }; }; }; constant b = ore.new(1); say ::<b> # Might be just utterly broken code, dont know enough of this language 15:05
camelia 2
2
scovit # but what is missing is a way to invalidate the lexical cache and to retireve the symbol "b" from $*W, any help?
moritz scovit: werm, what do you want to achieve? 15:08
scovit moritz it's an hack. I want to achieve to postpone the assignment of the constant b to after compilation 15:10
there are two problems: 1. how does ore know about the symbol "b" (e.g. the name of the constant) 15:11
2. m: use nqp; class ore { method new(Int $a) { if ($*W) { my $block := { nqp::bindkey(CALLER::, "b", self.new($a + 1)); }; $*W.add_object($block); $*W.add_phaser($/, "INIT", $block, class :: { method cuid { (^2**128).pick }}); } else { say $a; return $a; }; }; }; constant b = ore.new(1); say b # this, b for some reason is not the same as ::<b> I suspect a chaching issue 15:12
m: use nqp; class ore { method new(Int $a) { if ($*W) { my $block := { nqp::bindkey(CALLER::, "b", self.new($a + 1)); }; $*W.add_object($block); $*W.add_phaser($/, "INIT", $block, class :: { method cuid { (^2**128).pick }}); } else { say $a; return $a; }; }; }; constant b = ore.new(1); say b #
camelia 2
No such method 'gist' for invocant of type 'QAST::Op'. Did you mean any of these?
isa
list

in block <unit> at <tmp> line 1
moritz scovit: re 1, it doesn't. That's what encapsulation and separation of concerns etc. is all about 15:13
jnthn 12:40 < jnthn> constant means "at BEGIN time" 15:14
12:40 < jnthn> If you don't want something to happen then, don't use constant.
Further, every time the constant is mentioned in code, it will be resolved to the constant value it was set to at BEGIN time
As part of the compilation
scovit ok, was just crazy for 1/2 an hour, sorry 15:16
scovit I realize the practical impossibility jnthn 15:17
jnthn Yeah, to be fair sometimes "don't do X" means "IMO it's a really bad idea", but in this case it was really one of the "it's actually impossible" cases :-) 15:19
scovit
.oO(installing a random number in b, and using NativeCall to find and scan the bytecode and substitute all references to this number to the actual object created later at INIT time :) .. let the idea flow and goes back to more productive works)
15:26
lizmat dinner& 15:34
geekosaur something horrid like BEGIN my $b = 0; INIT $b := whatever; ?
although that likely does not accomplish whatever optimization hack you were after. really, just don't do that, it sounds like a trainwreck looking for any possible chance to happen 15:35
scovit geekosaur there was a practical problem which I wanted to address 15:37
geekosaur my module segfaults if used in a certain way
even worst: while it can be used in a correct way it feels totally natural to use it in the wrong one 15:38
scovit constant ERROR_MSG_BAD = CBuffer.new("File not found"); # Segmentation fault 15:39
scovit our $ERROR_MSG_BAD is export = CBuffer.new("File not found"); # Totally fine 15:40
geekosaur if CBuffer is via NativeCall then your expectations are violated by expecting your dynamic FFI context to exist at compile time 15:41
Zoffix . 16:09
yoleaux 7 Sep 2017 18:42Z <lizmat> Zoffix: I feel that tests 3/4 of S24-testing/8-die_on_fail.t are bogus
11 Sep 2017 03:29Z <AlexDaniel> Zoffix: toaster plz
smls .. 16:09
yoleaux 11 Sep 2017 22:11Z <TimToady> smls: no, that wasn't intended
Zoffix .tell AlexDaniel no toaster from me this month. I'm away on vacation. 16:10
yoleaux Zoffix: I'll pass your message to AlexDaniel.
scovit geekosaur: FFI is working fine, the segfault is at runtime since the Buffers were allocated once at compilation and are not there anymore 16:41
geekosaur well, same point really. it may be "natural" to you to confuse runtime and compile time. not natural to me
raschipi scovit: Perl6 isn't C++ 16:43
scovit it is expectable from the user point of view to see CBuffer.new("File not found") as something opaque
ok, I feel that we are turning the direction of the conversation of "what is the use of a CBuffer" object. right? 16:44
raschipi Nope.
raschipi "Doctor, it hurts when I do this." 16:45
Xliff {...} # DunDoDat 16:46
Sorry. I couldn't resist.
raschipi scovit: Just don't try to use C++ idioms in Perl6. 16:51
scovit raschipi what do you mean? Which idiom struck you?
raschipi "constant ERROR_MSG_BAD = CBuffer.new("File not found");" 16:52
Even the underlines are there.
scovit it is because this is a C++ api, right. At some point I need a C buffer with that string inside. And using Str in nativecall does not work since sometime the Buffer are used for writing and should be caller allocated 16:55
it is a strange C api
Xliff So why does it need to be a constant?
geekosaur ... right, so when you said FFI was fdine you missed my point entirely 16:56
do you also think a file opened at compile time is still open at runtime?
scovit geekosaur I get your point
constant in Perl means compile time
there is no need for it to be constant. 16:57
it is in fact an error.. such a pity that you get "only" data corruption and segfault
raschipi It's like jumping to the void pointer in C, it will segfault. 16:59
smls scovit: I think `constant` in Perl 6 is not meant for the compiler to give you any guarantees that the object will remain constant, but rather as a way for *you* to tell the *compiler* that it may assume it remains constant. 17:00
geekosaur that was kinda what I was getting at with the variant using :=, it is closer to how the const modifier works in C/C++
scovit it was a #define in C/C++ eheh
geekosaur oh, that's even worse 17:01
because it's not a "constant" at all. it's a textual substitution during compilation
Xliff scovit: Is this for NativeHelpers::CBuffer?
geekosaur in fact, use it the wrong way and you are allocating and throwing away a bunch of things you might otherwise think are shared 17:02
scovit Xliff yes
Xliff Ahh 17:03
HoboWithAShotgun good localtime() you lovely people. is it possible to access a subs named arguments in form of a hash? 17:25
HoboWithAShotgun with in the sub 17:25
smls m: sub hi (*%args) { say %args}; hi :foo, :bar(42); 17:27
camelia {bar => 42, foo => True}
smls HoboWithAShotgun: ^^
you can use any name you want in place of `args`.
The *% makes it slurp up all named arguments into a Hash. 17:28
All *remaining* named arguments, more precisely. You can have normal named parameters before it. 17:29
ugexe m: sub foo(*%args [:$name1!, :$name2]) { say %args<name1>; say $name1; }; foo(:name1<xxx>)
camelia xxx
xxx
HoboWithAShotgun ah, ok. i was hoping for something like "sub foo( :$a, :$b ) { say %_{a}; } 17:30
ugexe m: sub foo(*%_ [:$a, :$b, *%rest]) { say %_<a> }; foo(:a<xxx>) 17:32
camelia xxx
HoboWithAShotgun amazinh
ty
HoboWithAShotgun m: sub foo(*%_[:$a, :$b, *%rest]) { say %_<a> }; foo(:a<xxx>) 17:43
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3sub foo(*%_[:7⏏5$a, :$b, *%rest]) { say %_<a> }; foo(:a<
HoboWithAShotgun significant whitespace?
smls Yes, subsignatures have to be separated from the parent parameter with whitespace. 17:45
HoboWithAShotgun is there a more idiomatic way to express " my $sides = ['a', 'b', 'c'].grep({ $_ ~~ %_ }).elems; " 17:58
scovit geekosaur: you wouldn't believe, macro a is export { quasi { CBuffer.new("Ciao"); } }; works perfectly for the purpouse 17:59
going to advise people to use that; is the only sane way
to keep the C semantics 18:00
geekosaur actually I would believe, if the C macro works. just be advised macros in p6 are still experimental and pieces are missing (but what you are doing is likely fine)
smls HoboWithAShotgun: What do you mean for the `.grep({ $_ ~~ %_ })` to do? 18:10
smls m: sub foo { say <a b c>.grep(%_).elems }; foo :c, :d, :e; 18:13
camelia 1
smls HoboWithAShotgun: This ^^ ?
gfldex .tell HoboWithAShotgun you can get hold of named params at runtime: gist.github.com/gfldex/44eeaceb7d0...214d0cccfc 18:47
yoleaux gfldex: I'll pass your message to HoboWithAShotgun.
gfldex do we got a module for unix domain sockets? 18:54
jnthn gfldex: Not that I know of, but there's a PR in MoarVM that, with a little tweaking, will provide that built-in once merged (well, plus merging some NQP/Rakudo patches) 19:12
Zoffix m: 「/o\ /o\ /o\ D: D: D:」.flip.say 19:22
camelia :D :D :D \o/ \o/ \o/
teatime what, lol 19:27
m: 'test'.flip.say 19:28
camelia tset
rindolf Zoffix: heh, nice 19:35
Zoffix :) 19:42
timotimo ack has a --nosql option 23:51