»ö« 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.
00:02 aindilis left 00:06 cpage_ left 00:08 AlexDaniel left 00:09 raschipi joined, AlexDaniel joined
Geth doc: fe2b7eb57a | (Will "Coke" Coleda)++ | htmlify.p6
avoid SEGV (no really)
00:09
00:11 raschipi left
DeadDelta \o/ 00:15
:D
[Coke] onto the next segfault. :( 00:16
00:18 AlexDaniel left 00:22 aindilis joined 00:23 amkhlv left 00:28 cpage_ joined 00:30 zacts left 00:31 astj joined, astj left 00:36 zacts joined
lookatme morning 00:37
00:39 skids left, Cabanossi left 00:40 Cabanossi joined 00:48 cdg joined 00:49 astj joined 00:52 cdg_ left, cdg left 01:00 travis-ci joined
travis-ci Doc build errored. Will "Coke" Coleda 'avoid SEGV (no really)' 01:00
travis-ci.org/perl6/doc/builds/247750484 github.com/perl6/doc/compare/4c00a...2b7eb57adf
01:00 travis-ci left 01:09 cyphase left 01:13 cyphase joined 01:45 ilbot3 left 01:48 ilbot3 joined, ChanServ sets mode: +v ilbot3 02:09 Cabanossi left 02:10 Cabanossi joined 02:12 freakcoco joined 02:17 noganex joined, cdg joined 02:20 freakcoco left 02:45 pm5 joined 03:07 vike joined 03:08 Cabanossi left 03:09 Cabanossi joined
BenGoldberg grumbles that * is too smart for it's own good. Testing to see whether the user passed in a * as an argument is annoying. :P 03:20
m: say * === *
camelia { ... }
BenGoldberg m: say * =:= *; # All variants just produce WhateverCode things :P 03:21
camelia { ... }
geekosaur m: say * ~~ Whatever 03:24
camelia { ... }
geekosaur bah
WhateverCode is ...
TimToady m: say Whatever.ACCEPTS(*)
camelia True
03:27 pilne left
TimToady in general, one should never test for whateverness using a literal * 03:28
m: given * -> $x { say $x ~~ Whatever } 03:29
camelia True
TimToady it's also fine if it's already in a variable 03:30
lookatme m: say so * === * 03:35
camelia { ... }
TimToady m: say (so * === *)(42,42) 03:36
camelia True
TimToady notes that so and not are operators, not listops
lookatme m: say * eq 42 ("42") 03:37
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say * eq 427⏏5 ("42")
expecting any of:
infix
infix stopper
postfix
statement end
statement modifier…
lookatme m: say (* eq 42)("42")
camelia True
TimToady things like eq and == are coercive, unlike === 03:40
lookatme oh 03:42
TimToady m: say (* == 42)("42") 03:43
camelia True
TimToady m: say (* === 42)("42")
camelia False
BenGoldberg m: say given * { when 42 { 'the answer' }; when * { 'star' } } 03:47
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of bare "say"; in Perl 6 please use .say if you meant to call it as a method on $_, or use an explicit invocant or argument, or use &say to refer to the function as a noun
at <tmp>:1
--…
BenGoldberg m: say do given * { when 42 { 'the answer' }; when * { 'star' } }
camelia star
BenGoldberg m: say do given 42 { when 42 { 'the answer' }; when * { 'star' } }
camelia the answer
BenGoldberg m: say do given 'other' { when 42 { 'the answer' }; when * { 'star' } }
camelia star
BenGoldberg m: say do given 'other' { when 42 { 'the answer' }; when 'star' { 'star' } } 03:48
camelia False
TimToady "when *" is equivalent to "default"
it always matches
BenGoldberg What's the clearest way to test whether the user passed in, say, an Int, a Str, or *, while rejecting objects of other types? 03:49
. o O (when .WHAT === *.WHAT) 03:50
TimToady refactor to a multi
or use: where Int | Str | Whatever 03:51
always test using the Whatever type, never with *
BenGoldberg m: say do given True { when Int { 42 }; when Str { 'perl6++' }; when Whatever { 'star' } };
camelia 42
BenGoldberg m: say do given pi { when Int { 42 }; when Str { 'perl6++' }; when Whatever { 'star' } }; 03:52
camelia False
BenGoldberg TimToady++
TimToady doesn't know why that returns False though
03:53 Cabanossi left
BenGoldberg I suppose you're one of those silly people who think that pi is 3, then? 03:53
03:54 Cabanossi joined
BenGoldberg m: say do given * { when Int { 42 }; when Str { 'perl6++' }; when Whatever { 'star' } }; 03:54
camelia star
TimToady m: my $*TOLERANCE = 1; say pi =~= 3 03:55
camelia True
BenGoldberg Your're horrible :P 03:56
TimToady m: my $*TOLERANCE = 1; say pi ≅ 3
camelia True
BenGoldberg Prettier, but that doesn't make it an Int.
geekosaur that's not the question, I think. it's not clear why we get False instead of, say, Any 04:02
since nothing is done for that case
BenGoldberg Oh, I see. Any or Mu or Nil would have made more sense, I suppose.
TimToady or Slip 04:03
m: sub (Int() $x) { say $x == 3 }(π)
camelia True
BenGoldberg remembers once asking why the sky was blue, and being told 'raleigh scattering', when his real question was Why *blue*
geekosaur because nitrogen. and beyond that, you get to flirt with quantum theory
TimToady well, same reason the sun looks redder through smoke, only less so 04:05
geekosaur nitrogen just happens to have an electron that, when hit with a photon of a particular shade of blue light, will "ring" for a microsecond or so and then spit it back out again in a random direction
BenGoldberg "Because nitrogen" would have good answer, back when I was asking that originally, since I was thinking numbers (wavelengths and amount of scattering), not mechanisms in general. 04:06
s/would have/would have been/
m: sub foo { slip() }; dd foo; 04:07
camelia Empty
geekosaur right, but understanding why that particular wavelength gets you into the energy levels of electron orbitals, which we haven't fully solved yet for anything beyond 4He iirc
BenGoldberg m: sub foo { slip() }; my $x = foo; dd $x;
camelia Slip $x = Empty
BenGoldberg m: sub foo { Slip }; my $x = foo; dd $x; 04:08
camelia Slip $x = Slip
geekosaur although we can observe them spectrographically
TimToady m: sub foo { slip() }; say foo.defined
camelia False
TimToady m: sub foo { Slip.new }; say foo.defined
camelia False
BenGoldberg TimToady, Under what circumstances would someone ever *see* a slip object, other than the undefined one?
TimToady m: sub foo { slip(1) }; say foo.defined 04:09
camelia True
TimToady slip is only undefined for the empty list
well, and the type object
BenGoldberg m: dd slip().defined 04:10
camelia Bool::False
BenGoldberg The only undefined Slip is the type object, afaict.
(Or I suppose a subclass, but that would be silly( 04:11
TimToady look above, Slip.new is also undefined
04:12 konsolebox left, Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg
BenGoldberg m: my WhenWet does Slip { }; sub foo { return 41, WhenWet.new, 42 }; say foo; 04:13
camelia 5===SORRY!5===
Type 'WhenWet' is not declared
at <tmp>:1
------> 3my WhenWet7⏏5 does Slip { }; sub foo { return 41, Whe
Malformed my
at <tmp>:1
------> 3my7⏏5 WhenWet does Slip { }; sub foo { return
BenGoldberg m: class WhenWet does Slip { }; sub foo { return 41, WhenWet.new, 42 }; say foo;
camelia 5===SORRY!5=== Error while compiling <tmp>
Slip is not composable, so WhenWet cannot compose it
at <tmp>:1
geekosaur Slip is not a role, so it would be 'is Slip' 04:14
BenGoldberg m: class Twinkle does Whatever { }; say Twinkle.new;
camelia 5===SORRY!5=== Error while compiling <tmp>
Whatever is not composable, so Twinkle cannot compose it
at <tmp>:1
BenGoldberg m: class Twinkle is Whatever { }; say Twinkle.new;
camelia *
BenGoldberg m: class WhenWet is Slip { }; sub foo { return 41, WhenWet.new, 42 }; say foo;
camelia (41 42)
04:14 cyphase left
geekosaur roles can promote to classes, classes do not demote to roles 04:14
TimToady that's because classes are mutable, while roles are immutable 04:15
geekosaur also I suspect the circularity could become a bit weird 04:16
04:16 konsolebox joined
BenGoldberg On the subject of 'is', I've got a bit of a problem. I was hacking away at my copy of NativeCall, and not testing it often enough; now my multi trait_mod:<is>(Routine,:$native!) is not getting exported, and I don't see what I did wrong. 04:18
Here is the gist of it: gist.github.com/BenGoldberg1/3f7b9...a5f791f86e
04:28 khw left
BenGoldberg is too sleepy to comprehend this tonight. I will figure this out mañana. 04:29
04:31 BenGoldberg left 04:37 wamba joined 04:42 wamba left 04:44 cyphase joined 04:48 curan joined, gfldex-mobil joined 04:50 cdg_ joined, eythian_ joined 04:52 cdg left 05:00 wamba joined 05:02 astj_ joined, astj left 05:03 cdg_ left 05:07 Cabanossi left 05:09 Cabanossi joined 05:15 epony joined 05:16 hythm joined 05:21 bwisti left 05:27 zapwai left 05:32 xtreak joined, gfldex-mobil left 05:35 ufobat joined 05:49 xtreak left, xtreak joined, wamba left 05:53 wamba joined 05:54 xtreak left 06:02 astj joined, astj_ left, wamba left 06:03 cyphase left
moritz DeadDelta: yes, I'll perlbrew an older perl 06:07
that's the solution my subconscious mind came up with during sleep as well :-) 06:08
(and it's kinda an attest to my lack of sleep that I didn't think of it earlier)
06:18 curan left 06:22 lowbro joined, lowbro left, lowbro joined 06:28 wamba joined 06:49 cyphase joined, seatek left 07:07 Cabanossi left 07:09 eythian_ left, cyphase left, eythian joined, eythian left, eythian joined, Cabanossi joined 07:12 cyphase joined 07:13 cpage_ left 07:15 domidumont joined 07:42 sivoais left 07:51 cpage_ joined 07:52 zakharyas joined 07:53 Cabanossi left 07:54 Cabanossi joined 07:56 parv joined 08:02 jonas1 joined 08:07 TimToady joined 08:11 d^_^b joined, d^_^b left, d^_^b joined 08:19 dakkar joined 08:37 zakharyas left 08:39 xtreak joined 08:52 Cabanossi left 08:54 Cabanossi joined 09:00 TEttinger left
moritz ok, running on an older perl now 09:02
the IR clogs are back up :-)
... with Unicody trouble :( 09:03
tadzik :( 09:04
moritz: what was wrong with the new Perl?
I remember seeing a word "leak" here somewhere
moritz tadzik: memory usage of the fastcgi process grew fast, making the whole machine swap 09:05
(and unresponsive)
tadzik ugh
09:06 guest__ joined, astj left, astj joined 09:11 parv left 09:25 zakharyas joined 09:36 lookatme left 09:37 bjz joined 09:39 wamba left 09:41 bjz left 09:42 bjz joined 09:44 xtreak left
grondilu yeah I can confirm it was terribly difficult to compile the latest perl last night 09:55
*perl6
09:58 astj left
DeadDelta grondilu: morits was compiling perl5 tho. What issues are you having with perl6? 10:00
moritz: the encoding is busted now :) "Geth¦ rakudo/nom: ce20887760"
10:01 wamba joined 10:02 mscha joined
mscha m: my @a = 1,2,3; my $verbose = True; .say for @a if $verbose; # No it isn't... 10:02
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing semicolon
at <tmp>:1
------> 032,3; my $verbose = True; .say for @a if 7⏏5$verbose; # No it isn't...
DeadDelta It is. You're trying to chain two statement modifiers 10:03
10:03 domidumont left
grondilu DeadDelta: yesterday compiling rakudo took much longer than usual and lagged my machine 10:04
10:07 astj joined, skids joined
DeadDelta .tell mr_ron yesterday's discussion about natives was wrong. Literals *are* supposed to work work with native multies if they can fit (which they now do, once again, on latest commit) 10:11
yoleaux DeadDelta: I'll pass your message to mr_ron.
DeadDelta grondilu: no idea. Haven't had such issues.
10:12 astj left
lizmat fwiw, /me neither 10:13
DeadDelta New post "Perl 6: Seqs, Drugs, And Rock'n'Roll (Part 2)": perl6.party/post/Perl-6-Seqs-Drugs...ll--Part-2 10:14
lizmat reads
s/usecase/use case/ 10:15
(at least according to my dictionary :-)
DeadDelta Thanks. Fixed. 10:16
10:16 astj joined
DeadDelta You likely won't learn anything from that post as you already know all of that better than me :) 10:16
lizmat well, there's one thing I'm not sure about 10:17
"The Iterator protocol forbids attempting to fetch more values from an Iterator once it generated the IterationEnd value"
I'm not sure that's true, I think the behaviour is undefined 10:18
timotimo i like how links have a slightly rounded border when you hover over them
lizmat jnthn? ^^^
timotimo um
i do believe we rely on that
jnthn lizmat: That's true
timotimo and i seem to recall an instance when some iterator or consumer did not honor that and things exploded violently
lizmat well, fwiw, I think all of the settings internal iterators you *can* call after IterationEnd and it will still generate IterationEnd 10:20
most of the time, it's just an effect of the implementation
jnthn It's fine if things do behave that way
It's just that you shouldn't rely on it
lizmat like needing to remember there's still one value to produce
even DeadDelta's example produces IterationEnd after it has produced its first IterationEnd 10:21
timotimo right
10:21 astj left
timotimo i find it slightly amusing that the one state variable will end up getting incremented more and more, while the other will stop at 4 10:21
not important at all, just a tiny detail
lizmat DeadDelta: s/brievity/brevity/ 10:25
DeadDelta Fixed thanks 10:29
10:31 FROGGS joined 10:55 sivoais joined 11:01 astj joined 11:06 zacts left, astj left, grondilu joined
grondilu finally received his additional RAM :) 11:07
Voldenet Did anyone make a grammar for C#? I need it for some tiny refactors and analysis (the current version in perl5 I use has gotten a bit /hairy/ and I need to add C#7 features for it)
11:07 Cabanossi left 11:09 Cabanossi joined 11:13 zacts joined 11:30 domidumont joined 11:31 wamba left 11:35 guest__ left
timotimo could it be the c# compiler has a feature that outputs parse data? 11:49
11:50 bjz left 11:54 AlexDaniel joined
moritz roslyn might have that 11:58
zengargoyle is there a .method on Hash that doesn't create arrays for duplicate keys like .push and .append do? something better than %stuff = %stuff, %new-stuff; 12:05
DeadDelta zengargoyle: %stuff ,= %new-stuff
DeadDelta backlogs a bit
m: say do given pi { when Int { 42 }; when Str { 'perl6++' }; when Whatever { 'star' } }; 12:06
camelia False
zengargoyle m: my %h = a => 1, b => 2; my %n = a => 2; %h .= %n; say %h; 12:07
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing required term after infix
at <tmp>:1
------> 3 = a => 1, b => 2; my %n = a => 2; %h .=7⏏5 %n; say %h;
expecting any of:
dotty method or postfix
12:07 Cabanossi left
DeadDelta TimToady: ^ that's False because Whatever is a :U and we're going through the Mu.ACCEPS that just type-checks. The `when *` uses a :D Whatever, which does the "anything goes" thing 12:07
zengargoyle m: my %h = a => 1, b => 2; my %n = a => 2; %h ,= %n; say %h;
camelia {a => 2, b => 2}
zengargoyle oh, , not .
should have guessed that by now. :) 12:08
12:09 Cabanossi joined 12:13 FROGGS left 12:14 wamba joined
DeadDelta .tell BenGoldberg your `is native` export issue is 'cause you got my package EXPORT::DEFAULT my package EXPORT::types. I don't think the `is export` things are additive. 12:18
yoleaux DeadDelta: I'll pass your message to BenGoldberg.
Voldenet timotimo: well, one could user roslyn to do something similar and roslyn could be used to make such tool, but I want to smuggle as much perl as I can into projects ;)
DeadDelta .tell BenGoldberg oh maybe they are :/ as this works m: package Foo { my package EXPORT::DEFAULT {}; sub bar is export(:DEFAULT, :meows) { say "hi" } }; import Foo; bar 12:19
yoleaux DeadDelta: I'll pass your message to BenGoldberg.
12:20 mscha left 12:21 ChoHag joined 12:22 grondilu left, exprosic joined, exprosic left
perlpilot DeadDelta: Nice article! It would make a nice Iterator tutorial on docs.perl6.org if there isn't one there already 12:27
DeadDelta Considering even basic docs for Iterator's methods use very confused examples, there probably isn't. 12:28
12:28 raschipi joined
timotimo DeadDelta: it's spelled monstrosity (had to double-check though) 12:32
raschipi m: say test
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
test used at line 1
raschipi m: say "test"
camelia test
DeadDelta Fixed. Thanks 12:33
zengargoyle yay! `at` parser is working. modulo squishing actual output into `at` acceptable. no timezone, seconds, always goes into the future, rejects datetime in the past.
timotimo np 12:34
good post!
zengargoyle think i might try to add a couple of options to be strictly-at or a more liberal
12:42 cdg joined 12:49 wamba left
melezhik hi Perl6 gurus! 12:51
DeadDelta Hello.
melezhik How to create directories in Perl6 recursively? Seems like docs.perl6.org/routine/mkdir can't do it
DeadDelta Yes, it can.
melezhik ahh 12:52
DeadDelta melezhik: what do you mean by recursively? like mkdir -p?
melezhik yeah
exactly
DeadDelta Yeah, that'd default behaviour of Perl 6's mkdir
melezhik ahh, good to know!
thanks
Geth doc: 9764f5eb14 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Path.pod6
Add more clarifications for mkdir

that it's like `mkdir -p`
12:53
doc: 6486f4e30d | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Path.pod6
Use more elaborate example for mkdir with nested dirs
12:55
12:56 mcmillhj joined
Geth doc: 6d24253dc2 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO/Path.pod6
Fix typo
12:56
DeadDelta lizmat: not feeling guilty for sloppy commits like that ^ is my reason :) RE github.com/rakudo/rakudo/commit/41...t-22498793 12:57
lizmat DeadDelta: I'm just trying to get ahead so you will be listed 2nd :-) 12:59
DeadDelta lizmat++
zengargoyle return $++ if $++ < 4; -- heh, sorta confusing at first glance. 13:04
DeadDelta I like to sprinkle some intermediate/advanced features in my articles to kinda showcase the language and make people want to look up more features 13:05
than just what the article is about 13:06
raschipi What does it do? 13:08
timotimo the trick is that each of the $ is its own anonymous state variable 13:09
so you'll get ascending numbers but only up to the number 4
raschipi They will always be incremented toghether, right? 13:10
DeadDelta raschipi: $ is an annonymous state variable. $++ increments it. In return $++ if $++ < 4 uses two state vars to have the effect of `state $x; return $x if $x++ < 4
raschipi: no, the left one will stop incrementing (and stop being returned) once $++ returns 4
raschipi Right, thanks. I understood it.
DeadDelta But it don't matter much in that example, since the method isn't meant to be called forever after the point, just once 13:11
13:11 itaipu joined
DeadDelta well, not once; zero times. The two vars with bee at 4 and 5 after the last call. 13:12
13:13 astj joined
zengargoyle it's like those two $++ are $thing-to-return++ and $count-of-things-returned++ 13:15
timotimo yeah 13:16
DeadDelta m: dd "a􏿽xCC􏿽x88".subst("a", "x")
camelia "ä"
zengargoyle sorta thought $ was scoped to the same statement or something rather than being nope-exactly-this-once-here
DeadDelta Werid. Locally I get ""x􏿽xCC􏿽x88""
zengargoyle but i guess i just hadn't seen it used like this.
timotimo what you're getting locally there is utf8-c8
DeadDelta timotimo: but why am I? 13:17
It's on 2017.05-297-g608e886
13:18 astj left
DeadDelta Oh, I think we've been through this before. This is probably because my setup is busted on this box 13:18
Yeah, works fine in a script, when I don't use command line 13:19
13:20 raschipi left
timotimo strange 13:21
DeadDelta Yeah, it's something with encoding in my terminal. I get like chineese dates and stuff.
Should upgrade in a few months, so it'll be gone
timotimo huh, we don't do locale-based encoding though? 13:22
DeadDelta dunno. perlbrewed perl5 fails some of its unicode tests too on this box
DeadDelta & 13:23
timotimo i really haven't a clue what's wrong there
13:25 raschipi joined
raschipi Yay! New P6 version! 13:29
13:29 ctilmes joined
timotimo oh? 13:30
raschipi I just got 2017.06 from Debian.
timotimo ah, nice
El_Che raschipi: unstable? 13:31
they are really keeping up
raschipi Yeah, I use unstable with experimental for Perl6.
13:38 gregf_ joined 13:41 rindolf joined 13:46 travis-ci joined
travis-ci Doc build errored. Zoffix Znet 'Add more clarifications for mkdir 13:46
travis-ci.org/perl6/doc/builds/247925714 github.com/perl6/doc/compare/fe2b7...64f5eb14fd
13:46 travis-ci left
Voldenet > curl ix.io/y4R | perl6 -e 'lines().say' 13:47
malformed utf 13:48
it looks like a standard BOM though
13:49 travis-ci joined
travis-ci Doc build errored. Zoffix Znet 'Use more elaborate example for mkdir with nested dirs' 13:49
travis-ci.org/perl6/doc/builds/247926356 github.com/perl6/doc/compare/9764f...86f4e30d9e
13:49 travis-ci left
DeadDelta m: Buf[uint8]:0x<ff fe>.decode.say 13:49
camelia 5===SORRY!5===
Extra argument not allowed; pair already has argument of 0
at <tmp>:1
------> 3Buf[uint8]:0x7⏏5<ff fe>.decode.say
You can't adverb Buf[uint8]
at <tmp>:1
------> 3Buf[uint8]:0x<ff fe>7⏏5.decode.say
DeadDelta m: Buf[uint8]:0x<ff fe>.decode.say
camelia 5===SORRY!5===
Extra argument not allowed; pair already has argument of 0
at <tmp>:1
------> 3Buf[uint8]:0x7⏏5<ff fe>.decode.say
You can't adverb Buf[uint8]
at <tmp>:1
------> 3Buf[uint8]:0x<ff fe>7⏏5.decode.say
DeadDelta gggrrr WHY do I always have dumb copy paste issues -_-
m: Buf[uint8].new(255,254).decode.say 13:50
camelia Malformed UTF-8 at line 1 col 1
in block <unit> at <tmp> line 1
DeadDelta Voldenet: is bom valid UTF tho?
13:50 travis-ci joined
travis-ci Doc build errored. Zoffix Znet 'Fix typo' 13:50
travis-ci.org/perl6/doc/builds/247926806 github.com/perl6/doc/compare/6486f...24253dc20f
13:50 travis-ci left
Voldenet DeadDelta: I'm sure "file".IO.slurp.say should handle BOM, if that's what you're asking 13:50
DeadDelta Ah
melezhik How can I add bash/shell script to Perl6 module distro? 13:51
just having script at bin/script.sh does make Perl6 treat it as shell script
raschipi DeadDelta: UTF-8 with BOM is valid
melezhik it tries to run is as Perl6 script 13:52
DeadDelta melezhik: you can put it in resources/ but I don't think it'll be installed in a way that'd make it runnable on user's system,
raschipi As much as I think it's broken and silly, it's valid.
melezhik probably I need to set shebang?
DeadDelta melezhik: what about permissions and PATH? 13:53
melezhik permissions are fine and script is resolvable
but it gets treated as Perl6 script
DeadDelta Voldenet: well, it fails with perl 5 too
melezhik I am going to set a shebang ... to see if it helps
DeadDelta melezhik: don't put it in bin 13:54
melezhik ok, where then to put it?
DeadDelta :|
melezhik ok, I may go with resource ... not a big deal
at least as workaround ... 13:55
zengargoyle i though binary/shell/script etc. you wanted installed along with a module went into 'script'
DeadDelta raschipi: what's UTF-8 with BOM? When I try to open a file with Voldenet's data in perl5 it dies the same as Perl 6, saying it's not valid utf8 13:57
zengargoyle at least in p5 'script' was the 'install these into the bin directory when installing the module'. you had to tweak things if you *really* liked to keep your things in 'bin'
raschipi Windows puts BOMs in the starts of it's files and Unicode gave up and declared it valid.
zengargoyle BOM in UTF-8 is an abomination. 13:58
raschipi zengargoyle: I agree, but here is exibit A: archive.is/BxgyE 13:59
DeadDelta .tell samcv is BOM supposed to be valid in latest utf8? Buf[uint8]:0x<ff fe>.decode.say dies. Perl 5 does the same. But here people are saying that it's not supposed to die: irclog.perlgeek.de/perl6/2017-06-28#i_14798132 14:00
yoleaux DeadDelta: I'll pass your message to samcv.
14:00 cosimo joined
[Coke] ff 14:00
DeadDelta wonders if we need a "ff" lottery too :)
raschipi DeadDelta: IMHO, Perl6 should never die because of bad UTF-8, that's a ready-made DoS right there. 14:01
DeadDelta lol
mst does rakudo even build on DOS?
raschipi denial-of-service 14:02
zengargoyle raschipi: Windows explains most broken things. :P
[Coke] appreciated mst's dad-joke.
14:02 DeadDelta left
raschipi Any Perl6 program that deals with input dies right now if someone sends invalid UTF-8 14:03
mst zoffix just left and I was, indeed, making a dad joke
lizmat I think the DoS issue might make us consider making utf8-c8 the default encoding for everything ?
raschipi I liked the joke too, but I wanted to register what it meant in case someone got confused
Zoffix can't even right now 14:04
14:04 troys joined
ilmari ZoffOdd? 14:06
[Coke] .tell DeadDelta apparently I need a better system for "did my connection drop"
yoleaux [Coke]: I'll pass your message to DeadDelta.
14:06 cosimo left, Cabanossi left
raschipi From the Unicode FAQ: Can a UTF-8 data stream contain the BOM character (in UTF-8 form)? A: Yes, UTF-8 can contain a BOM. 14:07
www.unicode.org/faq/utf_bom.html
14:08 cosimo joined
raschipi Found the direct link: www.unicode.org/faq/utf_bom.html#bom5 14:08
14:09 seatek joined, itaipu left, Cabanossi joined 14:11 mr-fooba_ left
zengargoyle maybe we should emit all output with a BOM just in case. 14:13
raschipi lizmat: I think the default should be what's suggested in the Unicode section 3.9, Constraints on Conversion Processes, Best Practices for Using U+FFFD 14:15
lizmat link? 14:16
14:16 mr-foobar joined
raschipi "At that point, the converter can emit a single U+FFFD for the collected (but ill-formed) code unit( s)" 14:16
lizmat hope samcv reads this
raschipi Page 128 of the Unicode standard version 10
14:25 itaipu joined 14:26 lucasb joined
lucasb did anybody noticed that the irclog HTML pages is not displaying unicode characters correctly? 14:27
is it just on my machine?
14:27 bjz joined 14:28 bjz left 14:29 lowbro left 14:41 bwisti joined
[Coke] yes, moritz is aware. running an older version of perl5 to avoid a memory problem in the latest version. 14:45
... someone should offer to rewrite it all in six. :)
14:45 FROGGS joined 14:49 troys is now known as troys_
moritz ... and write a nice tool to clean up encoding mess in the database :-) 14:51
lizmat aaaahhh the memories :-)
Geth Inline-Python: 70477cfbd4 | Nic++ (committed using GitHub Web editor) | .travis.yml
Fix Travis

This should fix Travis auto-builds.
15:03
Inline-Python: babb15cc0b | niner++ (committed using GitHub Web editor) | .travis.yml
Merge pull request #24 from nicqrocks/patch-1

Fix Travis
15:06 cihan joined 15:07 Cabanossi left
cihan Hallo 15:08
15:09 Cabanossi joined
perlpilot cihan: greetings 15:10
tinita hi cihan
grwetings from the german perlworkshop in hamburg 15:11
s/grw/gre/
FROGGS hi cihan ;o) 15:12
cihan Hehe
Hi Tina und Froggs :)
FROGGS welcome to the awesome world of #perl6 15:13
cihan Thanks
15:15 andrzejku joined 15:16 cdg left 15:17 andrzejku left
El_Che hamburg o/ 15:20
hallo! 15:21
:)
how do you wave in ascii
15:21 bjz joined
FROGGS well, like you did 15:22
cihan o/
FROGGS the workshop was awesome, I'm glad that I made it
15:23 jonas1 left 15:27 rindolf left
El_Che FROGGS: was it mostly in german? 15:29
FROGGS El_Che: aye
El_Che good exercise
FROGGS because only two ppl were non native speakers (or listeners in that case) 15:30
one of them nwc10, and he has to learn germish anyway ;o)
15:31 astj joined
El_Che FROGGS: speaking dutch, I am kind of in a good starting position :) 15:33
15:36 astj left
FROGGS aye ;o) 15:38
stemming distance from dutch to deutsch is pretty low actually
15:39 pmurias joined 15:41 rindolf joined
raschipi That is what leads to the most interesting misunderstandings. 15:42
15:44 xzhao left 15:46 xzhao joined 15:49 xzhao left 15:51 xzhao joined, FROGGS left 15:52 TEttinger joined 16:02 user3 joined
user3 Path resolution. In the code below, how can I resolve ~/myfile, where ~ is /home/ssss, in order to get /home/ssss/myfile. Instead, this resolves the current working directory (/home/ssss) and prepends it to the original path like this: "/home/ssss/~/myfile".IO 16:06
my $p= IO::Path::Unix.new('~/myfile'); $p.resolve.say;
raschipi user3: you'll have to do tilde expansion yourself 16:08
16:08 nhywyll joined, Cabanossi left
raschipi tilde expansion is a function of the shell 16:08
user3 cant perl6 use $*HOME automatically ? 16:09
raschipi You can use "$*HOME/myfile" instead
16:09 Cabanossi joined
raschipi If you want something the shell does, you can call the shell 16:11
user3 ok, we need a perl6 shell then
just kidding
raschipi run "echo ~/"
user3 i think $*HOME will do fine
16:14 setty1 joined 16:20 cihan left 16:21 astj joined 16:25 astj left 16:27 itaipu left 16:29 epony left 16:30 cdg joined
user3 by the way, run "echo ~/" doesn't seem to work 16:31
16:31 cdg left
user3 m: run "echo ~/" 16:31
camelia run is disallowed in restricted setting
in sub restricted at src/RESTRICTED.setting line 1
in sub run at src/RESTRICTED.setting line 14
in block <unit> at <tmp> line 1
16:31 cdg joined
jnthn Needs to be shell "echo 16:32
oops
Needs to be shell "echo ~/"
user3 yes 16:33
16:33 cdg left, cdg joined
raschipi Like the docs say: "Shell escapes are a severe security concern and can cause confusion with unusual file names." That's why P6 doesn't do it. 16:34
16:34 epony joined
user3 why not design a bash-style perl6 shell? 16:35
would be much better than bash
Juerd Writing a shell is actually hard
And even if you manage to write a pretty good one, you'll find that users can't use it because it does things slightly differently. 16:36
I'm back at bash, after having used fish for a few months
raschipi my $proc = shell 'echo ~/', :out; my $captured-output = $proc.out.slurp: :close; say $captured-output.chop
user3 bash is awkward but gets the job done 16:37
raschipi Now with config management I mostly don't use shell anymore. 16:38
16:45 astj joined 16:48 mr-foobar left
seatek pointy blocks make me happy - just sharing ;) 16:52
timotimo they are good, eyah 16:53
16:55 mr-foobar joined
user3 why does this print "mydir/myfile".IO instead of "myvolume/mydir/myfile".IO 16:56
say IO::Path::Unix.new(basename => "myfile", dirname => "mydir", volume => "myvolume/")
evalable6 (exit code 1) Cannot dispatch to method new on IO::Path because it is not inherited or done by IO::Path::Unix
in block <unit> at /tmp/5PqCOM2SYG line 1
16:57 robertle joined
user3 does volume make sense only under Windows? 16:59
16:59 |oLa| joined
seatek volume on unix is weird -- just paths really 17:00
you mount volumes into paths
17:01 domidumont left
seatek so for accessing them, you just use paths -- doesn't make much sense with volumes 17:01
ilmari would argue that windows is weird for having user-visible volumes
seatek yeah it's inflexible in windows
17:01 skids left
seatek yeah docs in IO:Path::Unix say volume on unix will be empty string 17:02
17:03 zakharyas left
tyil tfw ´ and ¨ arent valid quotes :( 17:03
raschipi Well, windows does work like unix under the hood in the most recent versions. It's just very well hidden. 17:05
17:06 cgfbee joined 17:07 dakkar left 17:08 cfa joined
user3 basically, Bill Gates paid someone $10k to write the first DOS program, which is a scaled down version of unix, from then on his main paradigm has been to lower expectations by giving as little as possible to his users 17:11
17:12 eponym joined
cfa morning all. 17:12
bug: 'p6 --profile' segfaults (rakudo 2017.06-102-g864fa7298 on moar 2017.06-29-ga51ba620) 17:13
17:13 troys_ is now known as troys, eponym left
raschipi DOS is actually more based on CP/M, not Unix 17:13
cfa (encountered on mac, reproduced with a fresh moar install on linux)
user3 it resembles Unix a lot, except / replaced by \ and LF replaced by CRLF 17:14
in its commands, i mean, it resembles Unix
in contrast to the Mac 17:16
of the time
geekosaur both have DEC minicomputer OSes in their background 17:17
user3 Bill Gates = marketing expert 17:18
17:19 Voldenet left
seatek sales & legal 17:20
raschipi Yeah, they are similar because both were based on systems like TOPS-10, MULTICS, etc.
epony checkout xenix
17:28 st_elmo joined 17:29 araujo left
user3 the volume is empty on unix, but I used to have a dual boot system with A: for the volume in windows and ~/A for something equivalent to the volume on linux 17:32
that made it a lot easier to convert paths
17:33 araujo joined, araujo left, araujo joined
user3 i gather that the folks who decided that the Path volume on unix would be always empty have never had a dual boot system 17:33
seatek you just use paths and forget the volume - then you can make the path be whatever for dual boot, whateve ryou need. you can't (or couldn't ) change the volumen names on windows, though 17:41
17:47 mr-fooba_ joined 17:48 mr-foobar left 17:53 itaipu joined, literal_ joined
literal_ hello peeps 17:54
I'm trying to make a "loader" of sorts that will dynamically load up a perl6 file (a handler) and run a function or two. That part it easy enough, but I need the handler to have access to an API in the same program as the loader. Any good articles on something like this? 17:57
17:57 bjz left 17:58 bjz joined 18:00 Voldenet joined, Voldenet left, Voldenet joined 18:02 wamba joined
timotimo you can set up a dynamic variable before calling into the handler's code 18:03
the handler can then just access that variable and do whatever it wants with it
or pass your API objects as arguments to a common function the handler is supposed to implement 18:04
literal_ hm that's possible
but that feels kinda shoddy
But if it's less aggravation it's probably better 18:05
18:05 itaipu left 18:06 itaipu joined 18:07 DeadDelta joined
DeadDelta user3: yeah, volume is totaly ignored in Unix spec 18:08
Unix spec = IO::Spec::Unix
18:08 AlexDaniel left
DeadDelta backlogs further 18:10
18:10 AlexDaniel joined
DeadDelta and yeah, we don't do anything shell XYZ does with expanding ~/ to anything. The only weird thing we have is '-'.IO that when .open'ed uses STDOUT/IN, but so far there's a motion to remove that in future language versions 18:11
Note that $*HOME is not guaranteed to be set, so using "$*HOME/whatever" isn't 100% foolproof 18:12
m: %*ENV<HOME>:delete; dd $*HOME
camelia Nil $HOME = Nil
18:14 pmurias left 18:16 andrzejku joined, nhywyll left
seatek literal_: why not just load the API in the "handler"? Or do you need some variable brought over that you set in the API that only your main loader program has set? 18:18
18:18 FROGGS joined
user3 what is the best way to test if I'm on Linux or Windows 18:19
timotimo m: say $*KERNEL.is-windows 18:20
camelia No such method 'is-windows' for invocant of type 'Kernel'
in block <unit> at <tmp> line 1
timotimo m: say $*KERNEL.is-win
camelia No such method 'is-win' for invocant of type 'Kernel'
in block <unit> at <tmp> line 1
timotimo where was that ...
geekosaur m: say $*DISTRO.is-win 18:21
camelia False
timotimo ah, distro, yes
seatek When I need to do questionable things like sharing variables across objects, I usually use a singleton -- usually for stuff like database connections
user3 good
say $*DISTRO # OUTPUT: fedora (25.Workstation.Edition) 18:23
evalable6 debian (8.jessie)
18:23 literal_ left
DeadDelta user3: considering your earlier questions, out of curiousity, why do you need to know if you're on Windows? 18:23
user3 ok, but it's funny that the word "win" (in is-win) appears in the output on windows, while "linux" doesnt appear in the output on linux 18:24
DeadDelta Or why you're using IO::Path::Unix instead of regular one
user3 it's not completely consistent imho
FROGGS # ubuntu (16.04.2.LTS.Xenial.Xerus)
DeadDelta hm?
.is-win gives you a Bool True or False
DeadDelta doesn't follow what the word win has to do with anything
user3: $*KERNEL.say has linux in it 18:25
18:25 itaipu left
DeadDelta I get linux (3.2.0.23.generic) from $*DISTRO 18:26
m: $*KERNEL.say
camelia linux (4.4.70.18.9.default)
seatek debian (9.stretch)
user3 say $*KERNEL # OUTPUT: linux (4.11.6.201.fc.25.x.86._.64)
evalable6 linux (3.16.0.4.amd.64)
18:28 pilne joined 18:31 sjoshi joined
DeadDelta And it's an object, not a string, you can query parts you're interested in with methods 18:31
m: say $*KERNEL.name 18:32
camelia linux
DeadDelta c: HEAD say $*KERNEL.name
committable6 DeadDelta, ¦HEAD(2a8d1e7): «linux»
DeadDelta "win32" on win7
18:33 sjoshi left
DeadDelta BTW shell 'echo ~/' don't work on Windows, but $*HOME does give you user's home 18:34
18:36 cdg left
user3 isn't Win32 obsolete in this name: class IO::Path::Win32 18:38
Win32 barely still exists lol
raschipi Windows 10 is still win32 18:39
user3 yeah, but for how long?
raschipi Forever
user3 which computer manufactuer is going to keep making 32 bit computers forever?
raschipi Windows 64 bit is win32 too.
DeadDelta user3: you don't need to use subclasses of IO::Path other than for testing purposes. Just use IO::Path and it will Do The Right Thing on all OSes 18:40
TEttinger win32 is used to avoid the trademark on Windows
it's a de facto name 18:41
user3 what about windows0000
FROGGS what is windows0000? 18:45
moritz it's when the windows version will overflow in the year 10k 18:46
FROGGS win32 is the operating system name that many compilers and other things spit out when you ask them... (e.g. cygwin)
TEttinger doesn't matter if it's an x86 or other architecture
user3 what are they gonna do when they reach the name Windows 13? 18:47
move directly for 12 to 14?
*from
DeadDelta Why?
TEttinger Windows "Holy cow we still exist"
user3 recall Apollo 13 !!!!
18:47 lichtkind joined, literal_ joined
DeadDelta doesn't recall 18:47
18:47 mscha joined
TEttinger Windows Existential Crisis 18:47
timotimo bring apollo 13 home!
DeadDelta doesn't understand what rocket has to do with Windows
TEttinger they would avoid 13 for the same reason as 4 I guess 18:48
DeadDelta heh
stupid humans and there silly superstitions
TEttinger every culture has unlucky and lucky number associations
well, the ones with numbers
DeadDelta And that's why the robots will win :) 18:49
18:49 DeadDelta left
TEttinger *their 18:49
geekosaur microsoft will do what microsoft will do, and the rest of the world will have to deal.
FROGGS win32 v6.1 would be Windows 7 for example (I think)
(maybe Windows Server 2008 (R2) too)
and the operating systen name does not say anything about the architecture, so the 32 in there is quite meaningless
r: say $*KERNEL.bits
that's what you'd use instead
(outputs 64 here)
18:49 FROGGS left
camelia 64 18:49
18:50 FROGGS_ joined
mscha m: say [X] [[1,2,3],[4,5,6]]; # correct 18:50
camelia ((1 4) (1 5) (1 6) (2 4) (2 5) (2 6) (3 4) (3 5) (3 6))
TEttinger windows 7 is v6.1 for historical compatibility reasons, the same reason why win32 is not useless as a name
mscha m: say [X*] [[1,2,3],[4,5,6]]; # correct
camelia (4 5 6 8 10 12 12 15 18)
mscha m: say [X] [[1,2,3],]; # correct
camelia ((1 2 3))
mscha m: say [X*] [[1,2,3],]; # wrong? at least inconsistent, should be (1, 2, 3)
camelia (6)
TEttinger it looks like that's vector math? 18:51
18:52 MasterDuke joined
TEttinger multiplying two vectors in an earlier example. but multiplying a vector by a scalar is a scalar for at least one arrangement of the arguments, right? 18:52
timotimo it's not supposed to be, though
oh, haha
mscha: X is X, so it's comma-fying the list, so you get 1, 2, 3
when you use X*, you get multiplication instead of commafication, so you get 1 * 2 * 3
18:52 Cabanossi left
timotimo that seems consistent to me 18:53
18:54 cdg joined, Cabanossi joined
mscha timotimo: that's not what's happening: [X] [[1,2,3]] is commafying a list with one list 18:54
timotimo no, [X] [[1, 2, 3]] isn't even getting a list of lists passed to it
you mean [[1, 2, 3],], right? 18:55
mscha Yes, that's what the code examples have
timotimo [X] [[1,2,3],] ought to be the same as infix:<X>([1, 2, 3]) 18:56
hmm
i think i might see what you mean
mscha Since it gets 1 argument, should be a no-op
Actually, I changed my mind about [X] [[1,2,3],] being correct. It should be: ((1), (2), (3)), not ((1, 2, 3)). 18:57
[Coke] is anyone else seeing xt/space-after-comma.t fail in the doc repo?
18:58 user3 left 19:00 bwisti left
mscha m: say [X] [[1,2],[3,4],[5,6]] # 2×2×2=8 lists of 3 elements 19:04
camelia ((1 3 5) (1 3 6) (1 4 5) (1 4 6) (2 3 5) (2 3 6) (2 4 5) (2 4 6))
mscha m: say [X] [[1,2],[3,4]] # 2×2=4 lists of 3 elements 19:05
camelia ((1 3) (1 4) (2 3) (2 4))
mscha m: say [X] [[1,2],[3,4]] # 2×2=4 lists of 2 elements, I mean...
camelia ((1 3) (1 4) (2 3) (2 4))
mscha m: say [X] [[1,2]] # should be 2=2 lists of 1 elements, not 1 list of 2 elements
camelia ((1 2))
TimToady m: say [X] [1,2],[3,4] # outer [] are useless
camelia ((1 3) (1 4) (2 3) (2 4))
mscha m: say [X] [[1,2],] # should be 2=2 lists of 1 elements, not 1 list of 2 elements 19:06
camelia ((1 2))
mscha So how do I get what I need? If have a list of n lists (n ≥ 1), and I want the cross product. 19:07
Works fine for n > 1, but for n = 1 it decides to behave differently.
timotimo i do believe X will give you flat stuff 19:08
or is that only Z ... 19:09
m: say (1, 2, 3) X (9, 9, 9)
camelia ((1 9) (1 9) (1 9) (2 9) (2 9) (2 9) (3 9) (3 9) (3 9))
timotimo it's actually pairs, huh
i mean tuples
m: say (1, 2, 3) Z (9, 9, 9)
camelia ((1 9) (2 9) (3 9))
19:09 bwisti joined 19:10 konsolebox left
TEttinger m: say (1, 2, 3) Z* (9, 9, 9) 19:10
camelia (9 18 27)
timotimo m: say &infix:<,>(1).perl 19:11
camelia (1,)
mscha To be specific, I want the divisors for, say, 2³×3² = 72. 19:12
m: my @prime-powers = (1,2,4,8),(1,3,9); say [X*] @prime-powers;
camelia (1 3 9 2 6 18 4 12 36 8 24 72)
mscha That works.
Now I want the prime powers for 2⁴.
m: my @prime-powers = (1,2,4,8,16),; say [X*] @prime-powers;
camelia (1024)
mscha (divisors, I mean) 19:13
Oops, that's not what I get.
So how do I deal with this?
It's supposed to give me (1,2,4,8,16)
geekosaur that sounds wrong to me 19:16
19:17 wamba left
geekosaur oh, missed trailing comma. hm 19:17
Geth doc: 86213a4a23 | (Jan-Olof Hendig)++ | doc/Type/Supply.pod6
Added a few code examples
19:19
19:26 dwarring joined 19:35 cfa left 19:47 literal_ left 19:52 AlexDaniel left 19:53 khw joined 19:56 astj left 19:57 astj joined, astj left, astj joined 20:10 lizmat joined, travis-ci joined
travis-ci Doc build errored. Jan-Olof Hendig 'Added a few code examples' 20:10
travis-ci.org/perl6/doc/builds/248084633 github.com/perl6/doc/compare/6d242...213a4a2399
20:10 travis-ci left 20:14 troys is now known as troys_ 20:21 dubi0us joined 20:22 FROGGS_ left, dubi0us left 20:23 bjz left 20:25 DeadDelta joined 20:26 bjz joined
DeadDelta Voldenet: so we do actually handle BOM. You just used the wrong one. utf8 bom is three bytes long 20:26
20:26 nullcone joined
DeadDelta github.com/MoarVM/MoarVM/blob/mast...tf8.c#L360 20:26
20:28 dubi0us joined 20:33 dubi0us left 20:34 dubi0us joined 20:37 dubi0us left 20:38 Cabanossi left 20:39 Cabanossi joined, literal_ joined
literal_ Hey guys, when i `require` a file, what's the correct way to call a sub with a known name in there? 20:40
DeadDelta literal_: is it just a sub? There's no module or package in the file? 20:41
literal_ nope, just the sub and possibly other stuff 20:42
Oh, my bad
DeadDelta make it `our` and it should just work
our sub foo {…}
literal_ yes, the while thing's a module
20:42 sftp left
DeadDelta ok, does it got `is export` on it? thw sub 20:42
*the sub 20:43
literal_ yes
20:43 sftp joined
DeadDelta then run import ModuleName and it'll be imported 20:43
How it's not a module tho
?
DeadDelta relocates
literal_ Sorry, I said wrongly
literal doppelganger :P
yoleaux 1 Nov 2016 16:31Z <jnthn> literal: Seems that various occurences of once in Version, Process, Kernel, and Backtrace are vulnerable.
1 Nov 2016 16:32Z <jnthn> literal: disregard that, tab-o :)
literal_ the whole deal is a module 20:44
something along the lines of `unit module MyProject::Handler; sub init(some args...) is export { ... }` 20:45
oh hey other literal :P 20:46
20:48 pmurias joined, wamba joined 21:00 st_elmo left 21:01 dubi0us joined 21:02 dubi0us_ joined 21:03 espadrine left 21:06 dubi0us left 21:07 dubi0us_ left 21:11 raschipi left 21:12 andrzejku left 21:13 ufobat left
DeadDelta literal_: ok, is there a reason why you're using `require` instead of just `use`? 21:14
and import MyProject::Handler; after require will import the subs. There's, um, MyProject::Handler::EXPORT::DEFAULT::init() you can call it as too, if you don't wanna import 21:15
21:15 mcmillhj left
literal_ Yeah I'm using require because I don't have a guarantee at compile time as to what the name will be 21:17
21:18 dubi0us joined 21:19 lucasb left
DeadDelta m: my $name = 'Test'; require ::($name); ::('&\qq[$name]::EXPORT::DEFAULT::ok')(1) 21:20
camelia ok 1 -
DeadDelta Not sure how to `import` with a run-time name. It doesn't like `import ::($name)`
21:22 dubi0us left
jnthn import happens at compile time, not runtime 21:23
use = need + import, approximately
DeadDelta oh
21:24 dubi0us joined 21:25 troys_ is now known as troys, troys is now known as troys_ 21:26 troys_ is now known as troys 21:29 zacts left
literal_ Yeah hmm 21:31
seatek m: multi a($a, :$b = False, :$c = True) { say 'a' }; multi a($a, :$b = False, :$c = True, UInt :$d) { say 'b' }; a('test', :d(2)); 21:32
camelia b
seatek m: class C { multi method a($a, :$b = False, :$c = True) { say 'a' }; multi method a($a, :$b = False, :$c = True, UInt :$d) { say 'b' };}; C.a('test', :d(2));
camelia a
seatek Is that a bug?
jnthn No, all methods have an implicit *%_ 21:33
seatek hmm. ok 21:34
21:40 dubi0us left 21:41 dubi0us joined
seatek So, am I right in thinking then that multi dispatch isn't a good idea for methods unless you're dealing with positional parameters only? 21:43
El_Che I don't agree
I have methods that do the same thing but with different input (eg a file and a string) 21:44
I like that in perl6 I can have multi methods
while in e.g. go I need to go with methodForStr and methodForFile 21:45
seatek I do too -- I just wish that they behaved the same between methods and subs
El_Che I tend to write a prive generic method that is used by both public methods
that said, I am only now reading the backlog
seatek it matches differently between methods and subs 21:46
i thought i was insane, or that there was a bug
jnthn seatek: It's fine if you're using required named parameters 21:48
seatek: It's just that they are optional by default
El_Che what john says :)
DeadDelta john is always right :)
El_Che been bitten by that
DeadDelta ZofBot: all hail john!
El_Che his beard make him look wise, that's true
jnthn
.oO( who is this john guy and what's he doing with a vowel in his name? )
21:49
DeadDelta :)
seatek So, multi dispatch will not work as expected with named parameters unless the named parameters are all required. That would make sense with the slurpy bit 21:50
(with methods)
DeadDelta seatek: no, it works as expected. Nameds just don't participate in multi-dispatch, except for tie breaking and I think the difference you're seeing between the subs is only due to ALL methods have named args, while some subs don't 21:51
DeadDelta looks at earlier evals above
21:51 bjz left
DeadDelta Not sure why the chosen canidate differs there 21:53
seatek because theyr'e more like positionals in methods, even when they're named, because of *%_ 21:54
DeadDelta Ahhh 21:55
seatek i just tried it as a sub in a last desperate test before i leaped out the window -- and it worked as a sub one
DeadDelta Nah, I see why
seatek: in your sub case, the first sub is not a valid candidate because it cannot accept :d named param, so it despatches to the only candidate available: the second sub. In the method case however, the first one does match, so it goes to it 21:56
And it matches because in methods we have *%, so it can take the :d
m: class C { multi method a($a, :$b = False, :$c = True, UInt :$d) { say 'b' }; multi method a($a, :$b = False, :$c = True) { say 'a' }; };
camelia ( no output )
DeadDelta m: class C { multi method a($a, :$b = False, :$c = True, UInt :$d) { say 'b' }; multi method a($a, :$b = False, :$c = True) { say 'a' }; }; C.a('test', :d(2)); 21:57
camelia b
DeadDelta And now method goes to b too, because it's first in the list
seatek yeah there's that extra slurpy bit
which has the side-effect of making multi dispatch not behave as expected unless you're using required named parameters -- unless you're extrememly familiar with the language and know about that slurpy bit 21:58
21:58 rindolf left
DeadDelta I wouldn't place the knowing of *% bit to be that arcane TBH :/ 21:58
seatek which i didn't ;)
DeadDelta Though I don't think we have a full and complete list of how multi dispatch happens. 21:59
Which certainly would be helpful
seatek that's right there
no mention in the docs
DeadDelta We should tell john to do it :)
lol, john left :P 22:00
seatek it's a weird thing to say though because you'd expect it to be the same... it's a weird edge case... so it might sound funny in docs
like oh, you can go out and in any door in the house, except the side door on wednesday 22:01
who knew? ;)
22:01 john51 joined
DeadDelta It probably depends on your background. If you come from somewhere like Perl 5 where methods are subs, then sure. But otherwise, it doesn't seem strange for there to be difference 22:01
I mean, you have an invocant there at play too. So that right there is already a difference 22:02
seatek i'm just happy the world makes sense again
DeadDelta :)
seatek but i would change it ;)
22:03 john51 left
DeadDelta My spidey senses are telling me there's a very good reasons why methods have implicit *% 22:03
'cause it's expensive and would've been gone a long time ago :)
Probably something to do with inheritance or something.
or them being "latebound" or whatever. Like how you can statically optimize subs but have to wait till runtime to know what you're calling the method on 22:04
jnthn It's to make inheritance and deferring to the base class work out correctly 22:05
DeadDelta Ah
jnthn Named parameters are primarily for options
22:05 pmurias left
seatek yeah i figure there's super good reasons. it's just some weird little side effect that of course i fall into 22:06
jnthn Many good uses of inheritance delegate to the base class, since that's the safest way to be sure you're doing at least as much as the bae class does
22:06 john51 joined
jnthn *base 22:06
And this means that, provided you are doing it with callsame or similar, you can safely add an extra option to a method in a base class and not have to do changes in the subclasses
DeadDelta Makes sense. 22:07
jnthn But yeah, the cost of getting *that* right is the surprises that the implicit *%_ bring 22:08
lizmat wonders where :{} is getting parsed 22:09
DeadDelta It's an op at the end of ...
s: &circumfix:<:{ }>
SourceBabyDeadDelta, Sauce is at github.com/rakudo/rakudo/blob/2a8d...sh.pm#L768 22:10
lizmat aaaah
Geth doc: 6996421ddc | seatek++ (committed using GitHub Web editor) | doc/Language/functions.pod6
multi methods and optional named parameters
22:11 AlexDaniel joined 22:12 skids joined
El_Che the named/unnamed option is a little incoherent, but it's handy 22:14
22:15 bjz joined
El_Che it can make your api a little incoherent if you don't pay attention is what I mean 22:15
22:20 stmuk joined 22:23 k-man joined 22:24 robertle left, bjz left 22:28 linuksz joined, cpage_ left
linuksz why this code don't work? 22:29
sub modify ( $var)
{
$var = 5;
}
modify 1;
22:29 troys is now known as troys_
El_Che is rw 22:29
linuksz i am new to perl 6 22:30
Juerd linuksz: Because $var is a readonly alias. To get a read-write alias, use "sub modify ($var is rw) { ... }"
El_Che linuksz: sorry I wasn't more verbose. Too much multitasking. Juerd++
22:31 bjz joined, troys_ is now known as troys
Juerd linuksz: This is considered a bad style, though. Instead of having a function modify a variable directly, it's better to have the function return the new value and leave the task of assigning it to a variable to the caller: sub five { return 5 }; my $var = five; 22:31
linuksz: Besides that, in your code you're trying to assign 5 to the number 1. You can't change literals, they're always read-only.
El_Che Changing in place make sense eg when you have a big data structure and you want to save memory, imho 22:32
AlexDaniel yea, it is needed sometimes
linuksz it isn't the code i got problem with, it only an extraction from it to easier understand my problem
Juerd El_Che: There are always reasons for doing the ugly thing, but they're the exceptions :) 22:33
AlexDaniel that said, if you hava a data structure… that's probably in an object, right? And if so, you can probably change attributes of an object without is rw…
Juerd El_Che: This is why "is rw" exists, but is not the default
22:34 setty1 left
El_Che I have ugly style in a small production app 22:34
that won't compile on recent rakudo release
22:34 mcmillhj joined
El_Che I think I made a hash is ew 22:34
is rw
:)
need to rewrite that
linuksz my code that i made this extract from, does a few regexp matching, and string replacement on a string.
El_Che linuksz: I would return a new string 22:35
Juerd linuksz: Unless the string is expected to be huge, it's still better style to return the changed value rather than to change it in place
linuksz it don't change it in place
Juerd linuksz: You can get a copy of the variable using "is copy" instead of "is rw".
El_Che linuksz: it's *way* readable
AlexDaniel linuksz: so is there anything wrong with “is rw” or “is copy”?
linuksz: docs.perl6.org/type/Signature#Para..._Modifiers
Juerd really likes "is copy" and would want that in other languages. 22:36
Basically I get it in Perl 5, but only as a side-effect of unpacking @_ using assignment :)
AlexDaniel hehe
linuksz so if i give it for the subroutine as "is copy", it can modify it, but not globally, it only has effect in the code block?
but rw modifies it as it was declared globally? 22:37
AlexDaniel well, kinda, yes
22:38 Cabanossi left
Juerd linuksz: "is rw" will change the given variable, whereas "is copy" literally makes a copy and leaves the original untouched. 22:38
linuksz but why isn't "is copy" default?
22:39 mcmillhj left
timotimo because it's extra (expensive) work 22:39
Juerd linuksz: Because most of the time, you just want read-access to the variable. You get a read-only alias. That is, no copies are made, but there's some protection against accidentally writing to the variable.
22:39 BenGoldberg joined 22:40 AlexDaniel left, Cabanossi joined, AlexDaniel joined
AlexDaniel also, it makes the code easier to read 22:40
linuksz so if i pass it with "is copy", it will act as default in C, and it is only an enhacement by perl6 ?
Juerd In most languages that support aliasing or pass by reference, there's no protection against changing the variable. Perl 6 has the protection, and enables that by default. "is rw" just turns the write protection off. 22:41
22:41 bjz left
Juerd linuksz: My C is not good enough to answer that question :) 22:41
Besides that, C doesn't really have strings or bufs, which are probably the only data types for which "is rw" makes sense anyway :) 22:42
BenGoldberg m: my $test = 42; sub foo($bar) { say $test =:= $bar }; foo($test);
yoleaux 08:18 EDT <DeadDelta> BenGoldberg: your `is native` export issue is 'cause you got my package EXPORT::DEFAULT my package EXPORT::types. I don't think the `is export` things are additive.
camelia False
yoleaux 08:19 EDT <DeadDelta> BenGoldberg: oh maybe they are :/ as this works m: package Foo { my package EXPORT::DEFAULT {}; sub bar is export(:DEFAULT, :meows) { say "hi" } }; import Foo; bar
timotimo rejoice, you can now profile stuff again (if you get moarvm master) 22:43
BenGoldberg m: my $test = 42; sub foo($bar is raw) { say $test =:= $bar }; foo($test);
camelia True
BenGoldberg m: my $test = 42; sub foo($bar is rw) { say $test =:= $bar }; foo($test);
camelia True
BenGoldberg m: my $test = 42; sub foo($bar is copy) { say $test =:= $bar }; foo($test);
camelia False
zengargoyle in that things passed by C are just nubers on a stack (that you now own the location of) C is 'is copy'. 22:44
BenGoldberg Interestingly, without any of 'is rw', 'is copy', etc, it prints False, indicating they are separate objects. 22:45
zengargoyle one of those items might be a pointer which you can deref and use 'is rw'
El_Che or it may be an explosion :)
the readonly default is nice
seatek i love the ro default - it makes me behave 22:47
zengargoyle except when you want to do a ~~ in a method foo ($/) { ... } in an action class of a grammar. :P
22:47 AlexDaniel left 22:48 AlexDaniel joined
zengargoyle and i don't think 'is rw' or 'is copy' actually help there anyways... 22:48
neither does a scope with { temp $/; $s ~~ //; ... } 22:49
22:49 mcmillhj joined, AlexDaniel left 22:50 literal_ left, AlexDaniel joined 22:54 mcmillhj left 22:56 literal_ joined 22:59 linuksz left
DeadDelta m: my $b = buf8.new: 1, 2, 3; sub foo ($b) { $b.append: 42 }; foo $b; dd $b 23:00
camelia Buf[uint8] $b = Buf[uint8].new(1,2,3,42)
23:01 AlexDaniel left
DeadDelta Juerd: ^ there's no protection for mutating the object, like buf 23:01
23:01 |oLa| left
DeadDelta You simply can't assign to the container 23:01
Juerd DeadDelta: That's why I said "some" protection :)
timotimo yeah, there's a few immutable things, though 23:02
DeadDelta And is rw doesn't turn the protection off, it requires a writable container
timotimo like a Blob is the immutable equivalent of Buf
DeadDelta *doesn't just
m: -> $ {}(42)
camelia ( no output )
DeadDelta m: -> $ is rw {}(42)
camelia Internal error: inconsistent bind result
in block <unit> at <tmp> line 1
DeadDelta hahaha
Well, in a perfect world that would say something about wanting a writable container :) 23:03
m: sub ($x is rw) {}(42)
camelia Parameter '$x' expected a writable container, but got Int value
in sub at <tmp> line 1
in block <unit> at <tmp> line 1
Juerd DeadDelta: I'm assuming linuksz is a beginner and intentionally did not want to mention containers
DeadDelta It's the anon that makes it go weird 23:04
m: sub ($ is rw) {}(42)
camelia Internal error: inconsistent bind result
in sub at <tmp> line 1
in block <unit> at <tmp> line 1
[Coke] seatek: 6996421ddc appears to be missing a word
(in docs)
23:05 mcmillhj joined
DeadDelta Filed as rt.perl.org/Ticket/Display.html?id=131673 23:06
23:06 wamba left, literal_ left
DeadDelta m: my @a = 1, 2, [3, 4]; -> @z is copy { @z.tail.append: 42 }(@a); dd @a 23:08
camelia Array @a = [1, 2, [3, 4, 42]]
DeadDelta Same with `is copy` it won't let you get away with murder :)
23:10 mcmillhj left
DeadDelta zengargoyle: in those cases, just don't name the parameter $/ 23:10
class Actions { method foo ($bar) {} }; will work just fine, you'll simply have to access captures like $bar<foo> instead of just $<foo> 23:11
23:11 zacts joined
zengargoyle yeah, i just didn't want to go back and change all those $/ into $bar. but realized .substr would work even better. 23:14
plus i like being able to grep '($/' and find my action methods. 23:15
Geth doc: d92888310a | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/grammars.pod6
Show non-$/ var use in actions in example

  - Already mentioned in the adjacent prose
  - Also include example that shows you don't have to use `$/.make` and can just make
23:15 cdg left 23:21 literal_ joined, dubi0us left, mcmillhj joined, ctilmes left 23:24 dubi0us joined 23:26 mcmillhj left 23:28 dubi0us left 23:37 mcmillhj joined
Geth ecosystem: titsuki++ created pull request #348:
Add Chart::Gnuplot to ecosystem' -m 'See github.com/titsuki/p…
23:38
ecosystem: 6427314855 | titsuki++ | META.list
Add Chart::Gnuplot to ecosystem' -m 'See github.com/titsuki/p6-Chart-Gnuplot'
ecosystem: 1becf943fc | (Itsuki Toyota)++ (committed using GitHub Web editor) | META.list
Merge pull request #348 from titsuki/cgnuplot

Add Chart::Gnuplot to ecosystem' -m 'See github.com/titsuki/p…
23:39 dubi0us joined 23:40 nullcone left 23:42 mcmillhj left 23:43 dubi0us left 23:47 bjz joined
Geth doc: ecd74e95cf | seatek++ (committed using GitHub Web editor) | doc/Language/functions.pod6
Coke discovered my missing be
23:51
seatek [Coke]: thanks :)
23:53 mcmillhj joined 23:59 mcmillhj left