»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, std:, or /msg camelia p6: ... | irclog: irc.perl6.org | UTF-8 is our friend!
Set by masak on 12 May 2015.
00:14 Peter_R left 00:32 yqt left, vendethiel- left 00:33 rangerprice joined
rangerprice Hi everyone 00:33
00:36 colomon joined 00:39 colomon left, colomon joined 00:50 n0tjack joined, BenGoldberg joined 00:54 n0tjack left 01:16 aborazmeh left 01:18 colomon left 01:19 colomon joined 01:22 gfldex left 01:25 abaugher left 01:26 abaugher joined 01:37 aborazmeh joined, aborazmeh left, aborazmeh joined 02:06 noganex_ joined 02:09 noganex left
colomon m: say List ~~ Positional 02:30
camelia rakudo-moar e6f360: OUTPUT«True␤»
02:36 laouji joined
ShimmerFairy .tell jnthn I put japhb's code in val(), with minimum modification to make it work properly, and got marginal improvements (null program startup decreased by about .01s, profiling sorting line shows it went down ≈1.2s). It's of course better (so I'll keep it in ☺), but val()'s implementation seems to be a non-issue now 02:36
yoleaux ShimmerFairy: I'll pass your message to jnthn.
ShimmerFairy .tell jnthn I suspect having a version of val() in World.nqp, or perhaps even in NQP itself, for strings with compile_time_values would be the most helpful, considering how many constant strings in quotewords there are in CORE and such :) 02:39
yoleaux ShimmerFairy: I'll pass your message to jnthn.
02:46 Sqirrel left 02:54 n0tjack joined 02:58 ggoebel left 02:59 n0tjack left 03:01 skids joined 03:02 ggoebel joined 03:03 ggoebel2 joined 03:05 Sqirrel joined 03:06 ggoebel left 03:10 aborazmeh left 03:11 laouji left 03:12 laouji joined 03:15 ifim left 03:16 laouji left, laouji_ joined 03:40 n0tjack joined 03:47 lolisa joined 03:52 AlexDaniel left 04:01 orbusbak joined 04:02 gfldex joined, orbusbak left, orbusbak joined 04:05 orbus left 04:08 skids left 04:21 laouji_ left 04:26 laouji joined 04:30 MadcapJake joined 04:33 n0tjack left
jdv79 has never used :right 04:36
04:40 BenGoldberg left 04:41 khw left
dalek ast/allomorphs: 27cc5ac | ShimmerFairy++ | S32-str/numeric.t:
Improve testing functions in S32-str/numeric.t

The failure check now prints a .perl of the string it was given, so that the output makes sense (changing it from Q[+-3/-2] to Q[+"-3/-2"] , for example). The success check now uses 'is' instead of the weird use of 'ok' shown before, since 'is' works just fine.
04:46
MadcapJake in Supply's `done` method, why does it call the result of `$t.done()` github.com/rakudo/rakudo/blob/nom/...ply.pm#L74 04:47
dalek kudo/allomorphs: 7d56f92 | ShimmerFairy++ | src/core/ (2 files):
Reinstate the string-to-number code by japhb++

It's a bit faster than my version, and it was the original implementation, so in it goes, in preference of me wasting time trying to optimize my version further (since such optimizations at this point would've been of the trickier, more subtle variety).
The biggest functional change to it, aside from making it work in val(), was disallowing 'Infi' and 'NaNi' as valid numbers. Other test failures as a result of this code concern things like if Rat fractions should allow negative denominators, so it's been left untouched for now.
Unfortunately, it seems that the particular implementation of val() is not the cause for the perceived slowdown anymore, so this replacement doesn't offer much improvement. The cause is likely the existence of a bunch of val() calls on quotewords in CORE existing now. Handling val() calls at compile time where possible might offer the best improvement at this point.
04:50
04:58 dustinm` left 05:03 dustinm` joined 05:14 Sqirrel_ joined, Sqirrel left, rangerprice left 05:24 laouji left
moritz ShimmerFairy: marking the val(|) proto as 'is pure' might help to promote some calls to compile time 05:28
ShimmerFairy moritz: oh, what does 'pure' mean? 05:29
nvm, found the doc :) 05:31
moritz for the record, it means "can be constant-folded" 05:40
MadcapJake anyone able to answer my question above? Just trying to understand why Supply's done method calls the result of `$t.done()`? I thought `done` was jut a supplied callback? 05:44
is it because `$l` could be a Lock? 05:46
no, that couldn't be it because `&.done` is just a callback, it's not something handled internally. 05:48
05:53 kaare_ joined 06:01 perl6_newbee joined
MadcapJake It seems like both `done` and `emit` invoke themselves before proceding (emit procedes by invoking again with `msg` and done procedes by invoking if not nil). Is that accurate? I don't quite understand why that's necessary. 06:06
moritz I thought 'done' invoked the 'done' callback of the tap(s) 06:15
06:24 laouji joined
MadcapJake yeah it does, i just am trying to follow the code: `for self.tappers -> $t {my $l = $t.done(); $l() if $l;}` 06:25
what does the `$l() if $l` mean? I don't follow why that's necessary. 06:26
06:29 laouji left 06:31 xfix joined 06:33 laouji joined 06:39 lolisa left 06:40 RabidGravy joined 06:45 CIAvash joined 06:46 rurban joined
RabidGravy marning! 06:47
ShimmerFairy moritz: hm, adding a 'proto sub val(|) is pure {*}' seems to have made things worse. I'll try adding 'is pure' to just the single-value multi, though. (It does seem to have done stuff, at least, seeing as the optimize stage goes up about 10s with the addition ☺) 06:59
07:04 CIAvash left 07:05 CIAvash joined 07:11 TEttinger left 07:12 TEttinger joined 07:13 darutoko joined, CIAvash_ joined, CIAvash_ left 07:15 CIAvash left 07:20 ab5tract_ joined
ab5tract_ .tell MadcapJake that's because the return value of $tap.done() is the callback itself 07:21
yoleaux ab5tract_: I'll pass your message to MadcapJake.
ab5tract_ m: class Hap { has &.done }; my $f = Hap.new( done => { say "here we go"; 42 } ); my $b = $f.done(); $b.WHAT.say; $b().say 07:22
camelia rakudo-moar e6f360: OUTPUT«(Block)␤here we go␤42␤»
ab5tract_ .tell MadcapJake try this example: `class Hap { has &.done }; my $f = Hap.new( done => { say "here we go"; 42 } ); my $b = $f.done(); $b.WHAT.say; $b().say`
yoleaux ab5tract_: I'll pass your message to MadcapJake.
ab5tract_ .tell MadcapJake contrast that with replacing `my $b = $f.done()` with `my $b = &($f.done)()`. So the reason it is written this way is because the second option would be run time error if the tap did not define a done block 07:25
yoleaux ab5tract_: I'll pass your message to MadcapJake.
ab5tract_ *be a
07:26 rurban left 07:29 n0tjack joined 07:34 n0tjack left 07:38 lizmat left 07:51 vendethiel joined
nine Good morning #perl6! 07:55
ab5tract_ morning, nine! 07:57
nine I've just slept for 10 1/2 hours...this feels strange ;)
ab5tract_ :) 08:00
nine: so does the GMR (Great Map Refactor?) plan to address the points raised by postcircumfix.com/2015-08-29-untang...-hierarchy 08:05
dalek ast/gmr: 434b189 | (Stefan Seifert)++ | S (3 files):
Rename EnumMap to Map
08:06
ast/gmr: a2d3e62 | (Stefan Seifert)++ | S (7 files):
Merge Enum into Pair

This should reduce the confusion around enum, Enum an Enumeration. Pair now implements shallow immutability like List. Pairs themselves are immutable, but containers used as values can be assigned to.
nine ab5tract_: that blog post is exactly what I'm implementing 08:07
though half of it seems obsolete, as for example Hashes don't do Positional
ab5tract_ indeed 08:08
nine Note that it has not been decided, if we really want those changes. I'm just implementing them to see how much work it would be and what problems may arise. So far I like what I've seen. 08:09
ab5tract_ An exploratory branch :) 08:10
A Map for a potential voyage! (*baddum ching*) 08:11
ab5tract_ wanders to breakfast
08:13 SamuraiJack joined 08:14 pmurias joined
pmurias in which branch does the post glr rakudo live? 08:14
08:15 lizmat joined
ShimmerFairy pmurias: nom 08:17
lizmat commuting& 08:18
08:18 lizmat left 08:19 rurban joined 08:29 cognominal joined 08:31 ab5tract_ left
ambs we can't make perl6 a little more intelligent? "min 1..*" takes forever to compute. 08:34
RabidGravy yes 08:39
m: multi sub min(Range $a) { $a.bounds[0] }; say min(1..*)
camelia rakudo-moar e6f360: OUTPUT«1␤»
ambs not really... then min 10..5 would not work :-) 08:40
it I understood it correctly 08:41
s/it/if/
RabidGravy ah yes
ambs but yeah, not something relevant right now
was just messing around with ranges and lazyness.
ShimmerFairy Yeah, if rakudo knew how to determine if a range was all-ascending or all-descending, then there are some nice shortcuts that could be implemented :) 08:42
RabidGravy m: multi sub min(Range $a) { min($a.bounds) }; say min(1..*); say min(10..5)'
camelia rakudo-moar e6f360: OUTPUT«5===SORRY!5=== Error while compiling /tmp/qnrLbWOIpJ␤Two terms in a row␤at /tmp/qnrLbWOIpJ:1␤------> 3bounds) }; say min(1..*); say min(10..5)7⏏5'␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ s…»
08:43 ab5tract_ joined
RabidGravy m: multi sub min(Range $a) { min($a.bounds) }; say min(1..*); say min(10..5);' 08:43
camelia rakudo-moar e6f360: OUTPUT«5===SORRY!5=== Error while compiling /tmp/R2GRDS_HsY␤Unable to parse expression in single quotes; couldn't find final "'" ␤at /tmp/R2GRDS_HsY:1␤------> 3unds) }; say min(1..*); say min(10..5);'7⏏5<EOL>␤ expecting any of:␤ sing…»
ambs RabidGravy: I see what you are trying to do there :-)
RabidGravy m: multi sub min(Range $a) { min($a.bounds) }; say min(1..*); say min(10..5)
camelia rakudo-moar e6f360: OUTPUT«Cannot call min(Parcel); none of these signatures match:␤ (Range $a)␤ in sub min at /tmp/xFCWE2y0tQ:1␤ in block <unit> at /tmp/xFCWE2y0tQ:1␤␤»
RabidGravy or something like that
08:46 [TuxCM] joined 08:49 ab5tract_ left 08:53 camelia left, camelia joined, laouji left
nine m: say (1,2).WHAT 08:53
08:54 ChanServ sets mode: +v camelia
camelia rakudo-moar e6f360: OUTPUT«(Parcel)␤» 08:54
vendethiel camelia is pre-merge, IIRC 08:55
nine Yeah, trying to figure out how to fix that
08:56 laouji joined 08:58 laouji left 09:00 [TuxCM] left
jdv79 grondilu: i would help if i understood Digest better. there's a bunch of syntax i'm not familiar with in there. 09:01
09:01 laouji joined
RabidGravy right, off to the "White Isle" in a bit, see you all in two weeks. Don't break anything I wouldn't and play nicely 09:02
09:02 TEttinger left
nine Have fun :) 09:02
09:03 laouji left
RabidGravy always do :) 09:03
byeee
09:03 RabidGravy left, laouji joined 09:06 ndo joined 09:09 Ven joined
pmurias the post glr semantics are described in S07-glr-draft.pod? 09:09
nine More or less. That document is not up to date. 09:10
pmurias S07-lists.pod is pre-glr?
09:11 telex left
nine I don't think anyone has updated the specs yet. 09:11
pmurias that sucks badly :( 09:12
09:12 telex joined
nine m: say (1,2).WHAT 09:14
camelia rakudo-moar 13f829: OUTPUT«(List)␤»
nine \o/
vendethiel \o/
nine I disabled build of the jvm backend for now.
09:23 laouji left 09:27 laouji joined 09:36 mprelude joined 09:44 Ven left
nine m: (:a(1) :b(2)).perl.say 09:44
camelia rakudo-moar 13f829: OUTPUT«(:a(1), :b(2))␤»
09:46 rmgk_ joined, rmgk left, rmgk_ is now known as rmgk 09:51 perl6_newbee left 09:56 n0tjack joined
ShimmerFairy nine: I was thinking, could you and/or other people familiar with GLR put up a gist or something with bullet points on what's changed with having GLR (or at least the important bits of GLR), so it's easier for someone interested in updating the specs to do so? 09:58
10:01 n0tjack left
ShimmerFairy (I ask because I'm possibly interested in helping update S07 and related, but I'm not nearly familiar enough with GLR to write specs on it yet. A gist-like thing would just speed up that familiarization for someone like me ☺) 10:02
10:03 cschwenz joined 10:05 leont joined
leont How can I interpret a string as hex? 10:05
vendethiel m: say :16("CAFE"); # what was it?
camelia rakudo-moar 13f829: OUTPUT«51966␤»
ShimmerFairy Yeah, also available as :16<CAFE> or :16[12, 10, 15, 14] :) (though :16() will let you handle variables) 10:06
vendethiel m: my @a = 12, 10, 15, 14; say :16[|@a]; 10:08
camelia rakudo-moar 13f829: OUTPUT«51966␤»
vendethiel *g*
10:21 AlexDaniel joined
hahainternet i'm not exactly likely to be helping out with GLR but i would appreciate the same as ShimmerFairy, a nice summary somewhere when someone has time 10:21
10:30 SamuraiJack left
leont Interestingly, :16("0o10") == 8 10:34
Is that intended or a bug? 10:35
10:37 colomon left
ShimmerFairy intended, :16() only sets a default radix, which can be overridden by the string 10:37
10:40 dayangkun left 10:42 cschwenz1 joined 10:44 cschwenz2 joined 10:45 cschwenz left 10:46 cschwenz1 left
cdc ShimmerFairy: don't you think :16("0o10") should be rejected? For instance, in the follozing scenario: $input = prompt("Enter hex"); $checked-input = :16($intput)" 10:54
10:55 spider-mario joined
ShimmerFairy cdc: nope, the idea is that the string knows what it wants better than the surrounding conversion function. 10:55
It's been that way forever, so it's not my design decision in the first place :) . Nevertheless I agree with it.
10:56 kaare_ left
ShimmerFairy If you _really_ wanted to enforce hex, easiest way would be :16("0x" ~ $input) , which will die if the string ends up being "0x0o10" 10:56
hahainternet you'd want to do some sanitation on the input regardless 10:57
because 'z'
i'm half and half
it would be nice to know there were ways to be strict about formatting built in
11:04 colomon joined
cdc well, I understand your point, but :16("0o10") == 8 looks so weird to me. 11:05
11:07 cschwenz2 left
hahainternet cdc: it does, but if you gave that octal a variable name it would make much more sense 11:08
11:15 colomon left 11:17 colomon joined
MadcapJake m: class Hap { has &.done }; my $f = Hap.new( done => { say "here we go"; 42 } ); my $b = $f.done(); my $c = $f.done; my $d = &($f.done); say $b === $c && $c === $d; 11:18
yoleaux 07:21Z <ab5tract_> MadcapJake: that's because the return value of $tap.done() is the callback itself
07:22Z <ab5tract_> MadcapJake: try this example: `class Hap { has &.done }; my $f = Hap.new( done => { say "here we go"; 42 } ); my $b = $f.done(); $b.WHAT.say; $b().say`
camelia rakudo-moar 13f829: OUTPUT«True␤»
yoleaux 07:25Z <ab5tract_> MadcapJake: contrast that with replacing `my $b = $f.done()` with `my $b = &($f.done)()`. So the reason it is written this way is because the second option would be run time error if the tap did not define a done block
11:19 colomon left 11:21 colomon joined 11:26 ndo left
MadcapJake ab5tract: so in the case of assigning a method to a variable, there's no difference between `$f.done()` and `$f.done`? Both will just assign the variable to the given block. Is that correct? 11:33
ShimmerFairy both .done() and .done call a method 11:37
MadcapJake but if you do `my $b = $f.done` you don't call it, you just assign the block to $b
ShimmerFairy m: class C { method M { 42 } }; my $b = C.M; say $b.perl
camelia rakudo-moar 13f829: OUTPUT«42␤»
MadcapJake m: class C { method M { 42 } }; my $b = C.M; say $b.WHAT.say 11:38
camelia rakudo-moar 13f829: OUTPUT«(Int)␤True␤»
ShimmerFairy m: class C { method M { -> $a { say $a } } }; my $b = C.M; say $b.perl
camelia rakudo-moar 13f829: OUTPUT«-> $a { #`(Block|71367056) ... }␤»
11:39 laouji left, laouji joined
ShimmerFairy m: class C { has $.done }; my $obj = C.new(done => 42); say $obj.done.perl 11:39
camelia rakudo-moar 13f829: OUTPUT«42␤»
MadcapJake wait, what about when it's like this
ShimmerFairy m: class C { has $.done }; my $obj = C.new(done => { 42 }); say $obj.done.perl
camelia rakudo-moar 13f829: OUTPUT«-> ;; $_? is parcel { #`(Block|55982096) ... }␤»
MadcapJake yeah like that :P
timotimo that's how
ShimmerFairy when the "done" attribute is assigned a block, then calling the method returns that block :) 11:40
(the has $.done declaration creates 'method done' for you)
MadcapJake so it's not really a method, it's just a block? is that what i'm getting confused about?
ohhhhh
timotimo it's a method tthat returns a block
you'd call it an attribute instead of a method, probably
MadcapJake so when you instantiate the class, you're passing what the `done` method will return? 11:41
timotimo right, though of course the code in the class may re-assign to $!done or implement "method done" itself in a different way if it likes to
ShimmerFairy yeah, the 'done => { 42 }' part sets the value of the $!done attribute. The main difference between 'has $!done' and 'has $.done' is that you'll get a method done { $!done } made for you 11:42
11:43 laouji left, laouji joined
MadcapJake ok! I get it now! :) I was thinking that `has $.done` was just creating an empty "field". But really the `.` twigil means it's actually building an accessor/gette 11:43
timotimo that's right 11:44
MadcapJake awesome! Thanks so much for the explanation!
timotimo and if the . twigil gets combined with "is rw", the accessor will also allow assignment
ShimmerFairy MadcapJake: note that when you _use_ the attribute in your class' methods, $!foo is the actual variable, and $.foo is treated like $(self.foo) 11:45
MadcapJake ok cool, i read about `is rw` but it wasn't really making sense until now xD
11:48 laouji left, laouji joined
MadcapJake ShimmerFairy: but `$!foo` would only be available inside the class body, right? 11:48
ShimmerFairy yes
Use $!foo whenever you want to modify or otherwise use the attribute directly. $.foo is nice for letting subclasses define their own 'method foo' and getting that used 11:49
timotimo and $!foo is namespaced to the current class, so if you want to access a superclass' attribute "$!foo", you'll have to go a different way 11:52
ShimmerFairy m: class C { has $.bar; method foo { "This is a $.bar" } }; class D is C { method bar { "derived class" } }; say C.new(bar => 42).foo; say D.foo 11:53
camelia rakudo-moar 13f829: OUTPUT«This is a 42␤This is a derived class␤»
ShimmerFairy ^ example of what I was talking about with using $.foo
MadcapJake cool! Thanks ShimmerFairy & timotimo! It all fits now that I understand that darn twigil xD 12:07
12:14 kaare_ joined 12:16 CQ joined 12:18 leont left 12:20 lizmat joined, laouji left
lizmat waves from 2500m up on the Sierra Nevada 12:20
12:23 mprelude left, n0tjack joined 12:28 n0tjack left
FROGGS .tell japhb I'm unable to merge C++ support in rakudo until it got ported to jvm... and I cannot port it as long as the jvm build is broken 12:29
yoleaux FROGGS: I'll pass your message to japhb.
FROGGS TimToady / jnthn: I intend to bisect the setting this evening (by commenting stuff out), until the jvm build succeeds... if one of you have better ideas, please let me know 12:30
12:40 Loren joined
lizmat .tell TimToady looks like brokenness of Vampire-number/vampire-number.pl6 is also a @a := Seq issue 12:41
yoleaux lizmat: I'll pass your message to TimToady.
12:45 lizmat left
[Tux] o/ 12:45
12:49 rindolf joined
_itz m: say (1,2).WHAT 12:49
camelia rakudo-moar 13f829: OUTPUT«(List)␤»
_itz is jvm fixed?
TimToady nach nicht 12:50
yoleaux 12:41Z <lizmat> TimToady: looks like brokenness of Vampire-number/vampire-number.pl6 is also a @a := Seq issue
moritz but that's a current rakudo 12:51
on camelia
12:53 xfix left
timotimo is still a bit sad about the re-naming of the Cheese Shop to PyPI 12:54
ShimmerFairy moritz: JVM build has been disabled on camelia for the time being
moritz :sadface: 12:56
12:58 FROGGS left 13:26 cognominal left 13:30 colomon left 13:31 rurban left 13:32 aborazmeh joined, aborazmeh left, aborazmeh joined 13:37 AlexDaniel left 13:39 vendethiel left 13:40 AlexDaniel joined 13:41 laouji joined 13:48 skids joined 13:55 khw joined 13:56 vendethiel joined 13:57 FROGGS[mobile] left, FROGGS[mobile] joined 14:03 lichtkind joined
lichtkind cheers i saw parcel is gone 14:03
where can i read mor on that? 14:04
14:05 aborazmeh left
nine FROGGS[mobile]: do you have any idea, why after adding a multi method new($key, Mu \value) to Pair.pm I still get a "Default constructor for 'Pair' only takes named arguments" but only for this weird :a(1) b(2) case (without comma) 14:05
FROGGS[mobile]: I also removed $key.named('key'); and $value.named('value'); from make_pair in Actions.nqp 14:06
14:12 Sqirrel_ left
nine lichtkind: it's not yet documented 14:13
lichtkind nad whats main idea, that list can contain named vals ? 14:14
nine ?
lichtkind the amin idea between parcels was that they are not decided if they become list or hashes 14:17
what makes them dispensable 14:18
masak m: sub s($x) { $x ?? $x < 0 ?? -1 !! 1 !! 0 }; say s($_) for -42, 0, 42, NaN 14:21
camelia rakudo-moar 13f829: OUTPUT«-1␤0␤1␤1␤»
masak m: sub s($x) { $x / abs $x }; say s($_) for -42, 0, 42, NaN 14:22
camelia rakudo-moar 13f829: OUTPUT«-1␤Attempt to divide by zero using div␤ in block <unit> at /tmp/h1bOsgu6S9:1␤␤Actually thrown at:␤ in block <unit> at /tmp/h1bOsgu6S9:1␤␤»
masak (some wrong implementations of the 'sign' function I've found on Github so far)
m: sub s($x is copy) { !($x = +$x) ? $x : $x > 0 ? 1 : -1 }; say s($_) for -42, 0, 42, NaN 14:23
camelia rakudo-moar 13f829: OUTPUT«5===SORRY!5=== Error while compiling /tmp/as7bLcyhYe␤Unsupported use of ? and : for the ternary conditional operator; in Perl 6 please use ?? and !!␤at /tmp/as7bLcyhYe:1␤------> 3sub s($x is copy) { !($x = +$x) ?7⏏5 $x : $x > 0 ? 1 : -1 }; s…»
masak m: sub s($x is copy) { !($x = +$x) ?? $x !! $x > 0 ?? 1 !! -1 }; say s($_) for -42, 0, 42, NaN 14:24
camelia rakudo-moar 13f829: OUTPUT«-1␤0␤1␤-1␤»
14:24 cognominal joined
nine lichtkind: you mean Captures 14:24
lichtkind im pretty sure i mean parcel but i will recheck 14:25
masak m: sub s($x) { if $x > 0 { return 1 }; return -1 }; say s($_) for -42, 0, 42, NaN
camelia rakudo-moar 13f829: OUTPUT«-1␤-1␤1␤-1␤»
masak I'm thinking of writing a blog post follow-up about how virtually everybody who tries to implement/polyfill Math.sign is also too inexperienced to get it right. 14:26
but now that I'm looking around, I'm not sure I'll be able to research it enough without becoming too depressed about what I find. 14:27
m: sub s($x) { $x < 0 ?? -1 !! 1 }; return -1 }; say s($_) for -42, 0, 42, NaN
camelia rakudo-moar 13f829: OUTPUT«5===SORRY!5=== Error while compiling /tmp/QwvRM1MH6W␤Unexpected closing bracket␤at /tmp/QwvRM1MH6W:1␤------> 3 s($x) { $x < 0 ?? -1 !! 1 }; return -1 7⏏5}; say s($_) for -42, 0, 42, NaN␤»
masak m: sub s($x) { $x < 0 ?? -1 !! 1 }; say s($_) for -42, 0, 42, NaN
camelia rakudo-moar 13f829: OUTPUT«-1␤1␤1␤1␤»
lichtkind nine: your right but i thought it was the other way around for long time 14:28
masak there's definitely a blog post's worth in there, though.
mst lichtkind: I always suspected you were a little bit backwards 14:29
(sorry :)
lichtkind sometimes i am
_itz lichtkind++ # good .es art gallery tips :)
lichtkind thanks 14:30
yes leaving granada tomorrow
ShimmerFairy m: sub sign($n) { $n ?? $n / $n.abs !! 0 }; say (-42, 0, 42, NaN)».&sign # masak: this is my version :)
camelia rakudo-moar 13f829: OUTPUT«(-1 0 1 NaN)␤»
14:31 Begi joined
Begi Hey #perl6 ! I'm new to Perl6. I've code a little Reverse Polish notation calculator. Can you tell me what can I improve ? gist.github.com/Emeric54/b94d607aca841df8f2d8 14:33
Juerd Begi: That's nice! 14:34
In general, in any programming language, I think things become harder to read if you have many nested constructs and high indentation levels. It's a good reason to refactor things into subroutines. 14:35
That'll force you to think about how to share values. Explicit passing and returning is widely considered as the best solution, followed by hiding state in objects. 14:36
But for code this small it might be overkill :)
I'm not sure if "defined +$w" makes sense 14:37
vendethiel Juerd: that's to make sure .Int returned an Int :)
(at least that's what I'm guessing)
Juerd vendethiel: I don't understand. There's no .Int in the code.
vendethiel Juerd: there's a + 14:38
m: say +"foo"
camelia rakudo-moar 13f829: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏foo' (indicated by ⏏)␤ in block <unit> at /tmp/7VAhJ9Nxx4:1␤␤Actually thrown at:␤ in block <unit> at /tmp/7VAhJ9Nxx4:1␤␤»
vendethiel m: say defined +"foo"
camelia rakudo-moar 13f829: OUTPUT«False␤»
vendethiel the defined "traps" the failure :)
Begi Yes, I started with a subroutine, but I deleted it because the code was very small.
Juerd Oh wow, so +"foo" evaluates to an unthrown exception? 14:40
Which is then thrown if you use it where you can't?!
vendethiel Juerd: +"foo" evaluates to a Failure
Juerd I think I read about this, but this is the first time I understand it...
(I think) 14:41
vendethiel m: say (+"foo").WHAT.perl
camelia rakudo-moar 13f829: OUTPUT«Failure␤»
vendethiel m: say (+"foo").Bool
camelia rakudo-moar 13f829: OUTPUT«False␤»
Juerd m: sub bar ($f :D) { }; bar(+"foo")
camelia rakudo-moar 13f829: OUTPUT«===SORRY!===␤Cannot invoke this object (REPR: P6opaque, cs = 0)␤»
Juerd Slightly LTA. 14:42
Which object?!
vendethiel whoops. :-)
m: sub bar($f :D) {}; bar(1);
camelia rakudo-moar 13f829: OUTPUT«===SORRY!===␤Cannot invoke this object (REPR: P6opaque, cs = 0)␤»
vendethiel m: sub bar($f:D) {}; bar(1);
camelia rakudo-moar 13f829: OUTPUT«===SORRY!===␤Cannot invoke this object (REPR: P6opaque, cs = 0)␤»
vendethiel Juerd: you can't :D something that's not a type btw 14:43
m: sub bar($f:D) {};
camelia rakudo-moar 13f829: OUTPUT«===SORRY!===␤Cannot invoke this object (REPR: P6opaque, cs = 0)␤»
vendethiel Juerd: Any:D would work, fwiw
masak I just realized that NaN boolifies to True in Perl 6. have we ever thought about whether it should...? 14:44
(data point so far: it boolifies to false in JavaScript)
vendethiel has no idea, since he never writes code that takes NaN into account 14:45
14:46 raiph left
nine GLRR semantics in a gist: gist.github.com/niner/d5f825c07ce1f7a6f7bb 14:46
masak in a way, NaN (being a kind of numeric failure) feels falsy. 14:47
14:47 Begi left
nine At least what came to mind right now 14:47
14:47 skids left 14:48 laouji left
ShimmerFairy masak: I think the issue is that "not a number" is far too general for an easy answer 14:48
nine ShimmerFairy: gist.github.com/niner/d5f825c07ce1f7a6f7bb 14:49
ShimmerFairy thanks :)
nine I'll be happy to add clarifications and answer questions that this will raise.
ShimmerFairy Ah, so the $ protection was added then? Seems like the sanest option, considering how many problems not having something like it was causing :) 14:50
nine Added jnthn++'s clarifications about slurpies 14:52
masak ShimmerFairy: well, many languages do answer it by allowing NaN to be coerced, implicitly or explicitly, to a boolean value.
ShimmerFairy: I agree it's not an easy question. but there's certainly prior art.
ShimmerFairy masak: what I mean is the question of "is NaN truthy or falsy?"
masak and I'm wondering if there's any language out there besides Perl 6 that boolifies NaN to True.
ShimmerFairy nine: shouldn't 'is rw' be the one that leads to Array, if Lists are immutable? 14:53
14:53 raiph joined
masak hm, Perl 5 does too, it seems. 14:53
$ perl -Mstrict -wE 'say !! +"NaN"'
1
Loren m: say (+"fgg").perl 14:54
camelia rakudo-moar 13f829: OUTPUT«Failure.new(exception => X::Str::Numeric.new(source => "fgg", pos => 0, reason => "base-10 number must begin with valid digits or '.'"), backtrace => Backtrace.new)␤»
ShimmerFairy masak: from a purely bit-pattern perspective, NaN does have some on bits :P
14:55 dakkar joined
dakkar why does IO::Path cache the "exists" bit? 14:56
my $f = '/tmp/thing'.IO; $f.spurt('something'); say $f.e; # prints False 14:57
nine ShimmerFairy: well the "is rw" allows you to assign to @foo. It doesn't say anything about @foo itself. But other than having slowly come to terms with this, I share your confusion.
14:57 bbkr joined
ShimmerFairy nine: Another possibility is perhaps "use Array for *@, since we've flattened already and might as well enforce scalar containers, and use List for **@ , since we're keeping structure and shouldn't enforce containerization on any part of it" 14:59
nine Well there's still lizmat++'s proposal to have **@arr expose the single arg semantics we use for all builtins.
bbkr Hi. I've published new blog post of how to deal with asynchronous parallel nested documents processing (and don't get crazy). Enjoy: blogs.perl.org/users/pawel_bbkr_pab...bread.html ! 15:00
ShimmerFairy nine: how would you enforce single-arg rule like the "for" keyword, currently?
nine ShimmerFairy: oh it's easy. It just involves some nqp... 15:02
ShimmerFairy nine: is that because of GLRR? I recall that being default earlier 15:03
(that is, I remember that you couldn't get rid of single-arg earlier on)
15:06 lichtkind left
nine The canonical way seems to be having a multi candidate that takes a \value and one for **@values. Then first one does an istype(Iterable) && !iscont check on value 15:07
ShimmerFairy It'd be nice if that were easier to do :) .oO(***@i-want-single-arg :P) 15:10
15:14 bbkr left 15:15 n0tjack joined
grondilu m: constant foo = grep * % 2, 1 .. *; say foo[1]; say foo[1]; 15:17
camelia rakudo-moar 13f829: OUTPUT«3␤3␤»
grondilu m: constant primes = grep *.is-prime, 2 .. *; say (map 2 * *, primes)[^3]; say (map 3 * *, primes)[^3]; 15:18
camelia rakudo-moar 13f829: OUTPUT«(4 6 10)␤This Seq has already been iterated, and its values consumed␤ in block <unit> at /tmp/mNp30ZydZT:1␤␤»
grondilu m: constant @primes = grep *.is-prime, 2 .. *; say (map 2 * *, @primes)[^3]; say (map 3 * *, @primes)[^3];
camelia rakudo-moar 13f829: OUTPUT«(4 6 10)␤This Seq has already been iterated, and its values consumed␤ in block <unit> at /tmp/kUDir4ylC_:1␤␤»
grondilu m: my @primes = grep *.is-prime, 2 .. *; say (map 2 * *, @primes)[^3]; say (map 3 * *, @primes)[^3];
camelia rakudo-moar 13f829: OUTPUT«(4 6 10)␤(6 9 15)␤»
15:19 perl6_newbee joined, n0tjack left 15:21 dakkar left
FROGGS[mobile] nine: perhaps look of the ast what :a(1) :b(2) produces, to be able to reproduce it with other Perl 6 code 15:24
nine: if nothing helps I can look into it in about three hours 15:25
cdc bbkr: I think you wouldn't exhaust the thread pool if you move the start block after the recursive call, ie. "start { sleep 1 # here the chapter itself is processed }" 15:26
FROGGS[mobile] nine: though I plan to spend the night fighting the JVM breakage 15:27
cdc .tell bbkr: irclog.perlgeek.de/perl6/2015-09-06#i_11176345 15:28
yoleaux cdc: What kind of a name is "bbkr:"?!
cdc .tell bbkr irclog.perlgeek.de/perl6/2015-09-06#i_11176345
yoleaux cdc: I'll pass your message to bbkr.
15:35 bbkr joined 15:40 lolisa joined
bbkr cdc: yes, but this is suboptimal solution. It was my first attempt to fix: gist.github.com/bbkr/b27aca2d1a265...e-txt-L127 15:44
yoleaux 15:28Z <cdc> bbkr: irclog.perlgeek.de/perl6/2015-09-06#i_11176345
[Tux] GLR:
test 50000 54.743 54.658
test-t 50000 54.748 54.664
timotimo that's more than it used to be, huh? :(
bbkr I've even explained why it won't give full speedup, but whole post became too big so I got this solution removed. 15:45
[Tux] yes, but I have been able to test GLR just *once* before
[Tux] is building nom just now to compare
timotimo OK
masak ShimmerFairy: the correct answer, if such a thing existed, would of course be "Not a Boolean" :P 15:47
timotimo NaB, eh? 15:48
15:49 spider-mario left
timotimo hm 15:50
[Tux] have glr and nom been merged? I now get the same errors in nom as I get in glr
timotimo the problem i may be seeing is an eliminated-by-optimizer block has survived and that causes some trouble
or something
glr is now in nom, yes
cdc bbkr: oh, I see. 15:52
masak found a regression. 15:55
m: sub foo { sub bar($) { "OH HAI" }; bar 5 }; say foo
camelia rakudo-moar 13f829: OUTPUT«OH HAI␤»
masak m: sub foo { bar 5; sub bar($) { "OH HAI" } }; say foo
camelia rakudo-moar 13f829: OUTPUT«sub bar ($) { #`(Sub|71849184) ... }␤»
masak submits rakudobug
I think this is unusual enough that it hasn't been discovered yet in the spectests or ecosystem. 15:57
but we should probably have a spectest for it :)
anyway, behold! gist.github.com/masak/b9371625ad85cfe0faba -- fizzbuzz without conditionals in Perl 6 :) 15:59
(forked from a Clojure version)
garu masak++ 16:04
timotimo masak: so ... what is the bug? 16:05
vendethiel masak: you can also cheat and use && - || instead of ?? - !! :P 16:06
timotimo pah
but then you have a conditional on the LHS of && 16:07
vendethiel m: say True && 1 || 0;
camelia rakudo-moar 13f829: OUTPUT«1␤»
vendethiel timotimo: ?
masak timotimo: the bug is that the sub is not called if it's post-declared. 16:08
m: sub foo { bar 5; sub bar($) { "OH HAI" } }; say foo
camelia rakudo-moar 13f829: OUTPUT«sub bar ($) { #`(Sub|64738528) ... }␤»
masak ^ that's wrong.
vendethiel masak: it is called, you're just not "say"ing in it
masak no, look again.
vendethiel m: sub foo { bar 5; sub bar($) { say "OH HAI" } }; say foo
camelia rakudo-moar 13f829: OUTPUT«OH HAI␤sub bar ($) { #`(Sub|50845312) ... }␤»
masak oh, argh. 16:09
vendethiel masak: the say is after the return. what's returned is the last expr - the sub
masak yes, I'm wrong. ignore me. :)
masak goes to reject the ticket
timotimo :)
masak m: sub foo { return bar 5; sub bar($) { "OH HAI" } }; say foo 16:10
camelia rakudo-moar 13f829: OUTPUT«OH HAI␤»
masak that's what I meant.
timotimo good that it works :)
i'm pretty sure we rely on calling postdeclared subs in core, actually 16:13
mst masak: cute
masak mst: yes, one of those "ooh, I wish I had thought of that" ideas 16:14
of course, both multis and infix:<5> could be said to be conditional-ish in nature 16:15
infix:<%> *
typing with 8mo in lap :)
timotimo i think there's some oversharing of QAST::Var objects going on somewhere in rakudo and that's what messes up the optimizer :| 16:16
mst masak: felt very erlang-ish
TimToady I'm okay with NaN being !.so, and I think I'm even fine with it being !.defined, as long as it stays .DEFINITE 16:21
16:22 rangerprice joined
timotimo builds an evil hack (maybe?) into QAST::Var.new that records the line number and file name where it was called and outputs that into the qast dump 16:24
16:24 Loren left
masak TimToady: me too... I think. would be interested to know if anything (spectests, ecosystem) currently relies on NaN being truthy. 16:25
TimToady in particular, I suspect NaN should be considered failure for KEEP/UNDO
masak mst: I've learned to reach more and more often for that kind of locally-defined multis as a replacement for given/when inside a routine. 16:26
mst: it also works great for visitor/traversal algorithms.
rangerprice HI everyone !!
masak TimToady: yes, makes sense. 16:27
rangerprice: hi!
TimToady isn't everyone...
mst masak: hrm, why do you prefer it to given/when ?
I assumed you were just avoiding given/when to demonstrate the conditional-free-ness
TimToady extensible
timotimo hm. but how ...
rangerprice It is possible to "convert" perl package to C library ? 16:28
timotimo probably not the way you expect it to 16:30
rangerprice Or just possible to create a wrapper for perl library ? 16:31
perl package *
timotimo so you want to be able to call/trigger functions in a perl library from C code?
TimToady it is certainly possible, but likely not a priority before Christmas 16:32
timotimo it'll take quite a bit of roundabout work, i expect
TimToady moarvm needs a better embedding interface first 16:33
rangerprice yes Timo
FROGGS[mobile] well, you can load CU's already AFAIK
rangerprice Many people think that perl is dead, and this people go across Python instead.... 16:35
The French community of Perl don't exist
timotimo in order to run things, you first need an interpreter. if you want to run subs triggered "from outside", you'll likely need a bit of setup work to do that call properly
and then getting things back to C 16:36
for now, it may be easier to do things with RPC 16:39
or IPC, as it were
ugexe people thing every language is dead 16:42
think
TimToady
.oO(every language thinks people are dead)
16:45
timotimo if there are no speakers, then who made me? 16:46
16:46 Peter_R joined
TimToady Speaker for the Dead? 16:46
timotimo i have that book on a shelf at home and i meant to read it, but i didn't get around to it yet
ugexe 911, perl6 thinks im dead 16:47
rangerprice ahahhahahaaaa 16:50
16:51 CQ left, lichtkind joined 16:55 vendethiel left 16:56 vendethiel joined
ugexe when precompile is integrated into CompUnit's install process, how will someone test their module against the precompiled code without installing it? 16:57
16:57 MadcapJake left
ugexe such as code that precompiles without error (either correctly or incorrectly) but doesn't work properly when using the precompiled version 17:00
or would it be such that everything that is loaded would get precompiled, such that `prove -e "perl6 -Ilib" t/` *would* be testing the precompiled version 17:02
17:02 lolisa left 17:04 perl6_newbee left 17:06 BenGoldberg joined 17:16 FROGGS joined 17:18 lichtkind left 17:26 rangerprice left
cognominal I did not know I belonged to a dead community. Mongueurs are moribund, maybe. 17:32
timotimo mortgueurs 17:33
cognominal on a de la morgue, mais on n'y va pas. 17:34
double entendre on morgue :) 17:35
17:38 rangerprice joined 17:42 khw left 17:43 rurban joined 17:46 rangerprice left 17:51 xfix joined
vendethiel cognominal: there's more than one community... or something.. 17:54
17:56 espadrine joined 17:58 Sqirrel joined 18:02 lichtkind joined
_itz the GLRR gist is mostly a statement of future work rather how things are now? 18:02
cognominal I msg-ed him that #perlfr on freenode is dead and gave him correct pointers.
jdv79 _itz: what? the thing nine gisted is the difference between nom before and now. before meaning a few days ago i think 18:06
also, is GLRR a thing? or are you talking about the GLR. 18:07
vendethiel cognominal: it's sad it is, btw :(. I'm too lazy to setup irc again on this comp...
masak cognominal: double entendre being fr:"morgue" == en:"mortuary" | en:"haugtiness" ? 18:08
cognominal masak: yup
masak \o/
frog dissection: successful.
vendethiel nods and whispers "baguette"
18:08 spider-mario joined
masak vendethiel: I have a natural dislike of baguetter methods. 18:09
vendethiel don't you dare insult the baguette :-).
_itz I'm confused by " just assign the Seq to an @array variable." .. when I try to do that with File::Find its still a seq
vendethiel _itz: using := or =? you should use =
masak .oO( do not taunt the baguette )
_itz using :
errr
'=' I mean not ':=' 18:10
vendethiel m: my @lines = lines; say @lines.WHAT 18:11
camelia rakudo-moar 13f829: OUTPUT«(Array)␤»
vendethiel m: say lines.WHAT
camelia rakudo-moar 13f829: OUTPUT«(Seq)␤»
vendethiel _itz: seems to work here
_itz > use File::Find; my @files = find( :dir("."), :type('file')); warn @files.WHAT 18:12
Use of uninitialized value <element> of type Array in string context in block <unit> at <unknown file>:1
maybe its just File::Find (although the tests pass) 18:14
vendethiel I'd think so 18:16
FROGGS o/
vendethiel \o
timotimo o 18:17
_itz m: use File::Find 18:20
camelia rakudo-moar 13f829: OUTPUT«===SORRY!===␤Could not find File::Find in any of:␤ file#/home/camelia/.perl6/2015.07.1-745-g13f829c/lib␤ inst#/home/camelia/.perl6/2015.07.1-745-g13f829c␤ file#/home/camelia/rakudo-inst-2/share/perl6/lib␤ file#/home/camelia/rakudo-inst-2/shar…»
masak mst: sometimes given/when (or just whens) would work just as well. but multis are nicer for the recursive case I mentioned. they can also define operators, which is sometimes very useful.
18:20 yqt joined
mst masak: oooh, yeah, recursive I hadn't thought off 18:21
because at that point you're going to need to wrap the given in a sub otherwise
FROGGS nine: did you get any further wrt Hash.new or what it was? 18:22
18:24 lichtkind left, rangerprice joined
masak mst: I'd say the nice thing is often that the multis end up in a very small scope, and so it feels... hm, economic? the opposite of wasteful, in terms of polluting scopes. 18:25
mst eah
*yeah
18:33 rurban left 18:41 beastd joined
raiph m: macro it { $_ }; say it # masak, what am I doing wrong? 18:43
camelia rakudo-moar 13f829: OUTPUT«===SORRY!===␤Too few positionals passed; expected 3 arguments but got 2␤»
18:46 n0tjack joined
masak raiph: several things, though that's not a helpful error message. 18:47
this is what I think you wanted:
m: macro it { quasi { $_ } }; $_ = 5; say it
camelia rakudo-moar 13f829: OUTPUT«Bytecode validation error at offset 12, instruction 3:␤lexical operand index 3 out of range 0.. 1␤ in block <unit> at /tmp/BtRYrrt0J0:1␤␤»
masak whee
:/
this actually works, and is what you ought to probably do anyway: 18:48
m: sub it { $CALLER::_ }; $_ = 5; say it
camelia rakudo-moar 13f829: OUTPUT«5␤»
masak but note that by doing something like this, you hose optimizability. 18:49
raiph \m: sub it { $CALLER::_ }; $_ = 5; given 1 { given 2 { say it } }
m: sub it { $CALLER::_ }; $_ = 5; given 1 { given 2 { say it } }
camelia rakudo-moar 13f829: OUTPUT«2␤»
18:50 lichtkind joined
raiph masak: thanks; I was thinking the right macro would be just a compile time alias and avoid hosing opt 18:51
masak raiph: you've given me something to think about. I'm not sure what I would *want* $_ in a quasi block would do.
raiph: yes, in some universes I'm sure it'd do what you wanted, and then you're right, it would avoid hosing.
18:51 n0tjack left
raiph i've been thinking i'd one day be able to do that for about 15 years :) 18:52
masak raiph: the troubles you were experiencing when trying are a special case of the much more general rule: macros are not as straightforward as people think. ;)
I'm painfully aware that textual macros would help you here in a jiffy.
vendethiel
.oO( the general rule is that things are not generalizable )
masak but then again, so would synthetic Qtrees, probably. so there is that.
m: macro it { quasi { $COMPILING::_ } }; $_ = 5; say it 18:54
camelia rakudo-moar 13f829: OUTPUT«(Any)␤»
masak at some point, that might also work.
vendethiel I don't get why a plain quasi { $_ } doesn't work, btw. uses the macro's $_?
masak yes, I believe so. 18:56
vendethiel the error message is.. interesting :-)
masak more to the point, macros are supposed to return a Qtree/AST.
and $_ doesn't necessarily contain one.
vendethiel m: my $a; macro f { quasi { $a } }; say f; $a = 5; say f; 18:57
camelia rakudo-moar 13f829: OUTPUT«(Mu)␤(Mu)␤»
masak that used to work, I think. 18:58
at least there were concrete plans to add the scope fudging that would make that work.
19:01 lichtkind_ joined, lichtkind left, lichtkind_ is now known as lichtkind
raiph masak: thanks :) 19:01
masak no, thank *you*. 19:03
raiph masak: :) 19:05
While I look forward to using macros after christmas I have a (hopefully) much simpler thing I'm hoping for before then
Namely making a pure text alias for $_, $/ and $!
As part of a one-liner slang that works well on twitter 19:06
To be used along with idioms like:
m: my \array =@= 1,2,3; array[2] = 9; say array 19:07
camelia rakudo-moar 13f829: OUTPUT«[1 2 9]␤»
grondilu is confused by =@=
nine FROGGS: Pair.new. Unfortunately not 19:08
raiph because that avoids the problem of twitter turning, say, @foo into a link to user @foo
nine FROGGS: the AST is different, but I don't see how that could result in the error
raiph grondilu: same as = @ =
grondilu oh ok 19:09
doesn't that make is static though?
*it
timotimo ohai grondilu 19:10
grondilu hello
nine FROGGS: AST of :a(1), :b(2) which is working: gist.github.com/niner/64a4d6868ce1179dbe52 AST of :a(1) :b(2) which is failing: gist.github.com/niner/8b72965085167e70c8c4
grondilu m: sub f { my \a = @ = rand xx 2; } say f(); say f()
camelia rakudo-moar 13f829: OUTPUT«5===SORRY!5=== Error while compiling /tmp/krYtYvcv07␤Strange text after block (missing semicolon or comma?)␤at /tmp/krYtYvcv07:1␤------> 3sub f { my \a = @ = rand xx 2; }7⏏5 say f(); say f()␤ expecting any of:␤ infix␤ …»
grondilu m: sub f { my \a = @ = rand xx 2; }; say f(); say f()
camelia rakudo-moar 13f829: OUTPUT«[0.422296211330265 0.443838759020408]␤[0.722972848828959 0.882823727019912]␤»
19:11 rurban joined
grondilu well apparently not 19:11
m: sub f { @ = rand xx 2; }; say f(); say f()
camelia rakudo-moar 13f829: OUTPUT«[0.150346546436024 0.864600056747442]␤[0.81724423436766 0.547183014182375]␤»
timotimo nine: i've implemented "hunting" additional colonpairs for argument lists at some point in the past
grondilu m: sub f { state @ = rand; }; say f(); say f()
camelia rakudo-moar 13f829: OUTPUT«[0.128851429252551]␤[0.128851429252551]␤»
timotimo nine: what exactly is the problem? what is :a(1) :b(2) supposed to do?
FROGGS m: say Pair.new('a', 1, a => 1) 19:13
camelia rakudo-moar 13f829: OUTPUT«Too many positionals passed; expected 1 argument but got 3␤ in block <unit> at /tmp/W09EKfqBEF:1␤␤»
FROGGS m: say Pair.new('a', 1, b => 2) # nine: I think that is what happens...
camelia rakudo-moar 13f829: OUTPUT«Too many positionals passed; expected 1 argument but got 3␤ in block <unit> at /tmp/OAQev6U942:1␤␤»
FROGGS nine: here: gist.github.com/niner/8b7296508516...xt-L47-L60 19:14
nine timotimo: I have a branch where I merged Pair and Enum. Pair got a new multi new($key, Mu \value) candidate. I removed the $key.named('key'); $value.named('value') from make_pair in Actions.nqp. Everything works except for chained pairs like :a(1) :b(2)
FROGGS m: say (:a(1) :b(2)).perl 19:15
camelia rakudo-moar 13f829: OUTPUT«(:a(1), :b(2))␤»
FROGGS m: say (:a(1), :b(2)).perl
camelia rakudo-moar 13f829: OUTPUT«(:a(1), :b(2))␤»
FROGGS nine: so I just need to build rakudo/gmr?
timotimo huh, that's kinda weird
why does that work in the first pace
place
nine The error message is: "Default constructor for 'Pair' only takes named arguments" though it certainly has a multi new that does 19:16
FROGGS: yes
timotimo: I think the syntax is used for use Foo:ver<1>:from<nqp>
FROGGS nine: no, that's just a longname
timotimo you should be able to see that by just trying use Foo:ver<1>:from<nqp> and see what kind of error it gives 19:17
nine FROGGS: but this triggers the bug in a spec test: use t::spec::packages::S11-modules::Foo :others;
FROGGS nine: well, that's not a longname :o) 19:18
nine Anyway it really seems to be supported syntax. The question is just, why it doesn't work?
timotimo and perhaps a debug print that says everything that was taken from there
right, that's a pair argument for the export sub in Foo
FROGGS $ perl6 -e 'say (:a(1) :b(2)).perl' 19:19
Default constructor for 'Pair' only takes named arguments
nine I'm absolutely baffled. I added debug statements to the actions and both Pairs are constructed by make_pair and everything looks just the same 19:20
timotimo interesting how the 2 is added to the call that's supposed to build the first pair
oh
nine Yes, this QAST::SpecialArg thing I don't understand
timotimo of course
nine ?
timotimo it's a named
the pair constructor for :a(1) gets :b(2) passed as a named parameter
nine oh
FROGGS aye 19:21
nine So a *%args on my "new" candidate should help? 19:22
timotimo the dumping of that may want to be better
FROGGS nine: I think so
timotimo yes, but it might be better if we can get rid of the thing passing it in the first place
nine But it doesn't :( 19:23
timotimo what do the candidates look like for the new method?
nine Changed it to multi method new($key, Mu \value, *%args) { ... } but still get the same message
timotimo: github.com/rakudo/rakudo/blob/gmr/...re/Pair.pm 19:24
FROGGS nine: gist.github.com/FROGGS/5c502310bf7d5424246f
timotimo nine: can you print out the actual candidates for Pair.^can('new') or something? 19:25
m: .perl.say for Pair.^can('new')
camelia rakudo-moar 13f829: OUTPUT«method new (Enum $: :$key, Mu :$value, *%_) { #`(Method|36542608) ... }␤method new (Mu $: |) { #`(Method|35024240) ... }␤»
timotimo .o( this could actually use nqp::getcodelocation to print out file name and line number, too )
nine perl6 -e '.perl.say for Pair.^can("new")' 19:26
method new (Mu $: |) { #`(Method|37891016) ... }
method new (Mu $: |) { #`(Method|36357328) ... }
???
timotimo huh, i thought we had a method to get the code location 19:28
m: use nqp; nqp::getcodelocation(nqp::getattr($_, '$!do', Code)) for Pair.^can('new') 19:29
camelia rakudo-moar 13f829: OUTPUT«Cannot unbox a type object␤ in block <unit> at /tmp/bO6zLDFJ4J:1␤␤»
timotimo ... how do i do that again ...
lichtkind allright becasue parcel reform i will update my p6 datastructures slides 19:30
timotimo m: use nqp; nqp::getcodelocation(nqp::getattr(nqp::decont($_), '$!do', Code)) for Pair.^can('new')
camelia rakudo-moar 13f829: OUTPUT«Cannot unbox a type object␤ in block <unit> at /tmp/9D4trzNSB0:1␤␤»
timotimo huh?
m: my &meth = Pair.^can('new'); say &meth.WHAT 19:31
camelia rakudo-moar 13f829: OUTPUT«Type check failed in assignment to '&meth'; expected 'Callable' but got 'List'␤ in block <unit> at /tmp/J56xDSnnCZ:1␤␤»
timotimo er, yeah
m: my &meth = Pair.^can('new')[0]; say &meth.WHAT
camelia rakudo-moar 13f829: OUTPUT«(Method)␤»
timotimo m: my &meth = Pair.^can('new')[0]; say nqp::getattr(&meth, '$!do', Code); 19:32
camelia rakudo-moar 13f829: OUTPUT«Cannot unbox a type object␤ in block <unit> at /tmp/HIkV4nFbkP:1␤␤»
timotimo oh 19:33
obvious.
m: my &meth = Pair.^can('new')[0]; say nqp::getattr(&meth, Code, '$!do'); 19:34
camelia rakudo-moar 13f829: OUTPUT«P6opaque: no such attribute '$!do'␤ in block <unit> at /tmp/fX6KxaP3eZ:1␤␤»
timotimo m: my &meth = Pair.^can('new')[0]; say nqp::getattr(nqp::decont(&meth), Code, '$!do');
camelia rakudo-moar 13f829: OUTPUT«new␤»
timotimo m: my &meth = Pair.^can('new')[0]; say nqp::getcodelocation(nqp::getattr(nqp::decont(&meth), Code, '$!do'));
camelia rakudo-moar 13f829: OUTPUT«file => src/gen/m-CORE.setting, line => 13978␤»
timotimo nine: ^- this ought to help you
nine: also, a newer nqp will give you less spammy QAST::Var in your qast dumps 19:35
nine timotimo: that gives me the location of roto method new(|) { * } :-/ 19:39
timotimo ah 19:40
then you want its .candidates
or something similarly named
19:41 mprelude joined
nine perl6 -e 'say Pair.^can("new")[0].candidates.perl' 19:42
(method new (Mu $: *%) { #`(Method|50799664) ... }, method new (Mu $: $, *@, *%_) { #`(Method|50799816) ... }, method new (Pair $: Mu $key, Mu \value, *%_) { #`(Method|52335464) ... }, method new (Pair $: :$key, Mu :$value, *%_) { #`(Method|52335616) ... })
perl6 -e 'say Pair.^can("new")[1].candidates.perl' 19:43
(method new (Mu $: *%) { #`(Method|51762224) ... }, method new (Mu $: $, *@, *%_) { #`(Method|51762376) ... })
timotimo huh, wait a second
methods already have *% installed in their signatures anyway
so adding *% wouldn't help anyway, because it's a no-op 19:44
nine yep
timotimo hm
"Pair $:" ? 19:45
can you introduce a new proto method new to Pair, so that other multi candidates from superclasses will get shut out?
FROGGS nine: I'm spectesting this now: gist.github.com/FROGGS/e0a5b6ec63afef9817ae 19:47
timotimo didn't nine remove that very intentionally? 19:48
nine FROGGS: that reverts the change I made
FROGGS die he?
timotimo he did
FROGGS but.... that makes the example work 19:49
nine I need the positional candidate to avoid itemizing the value.
FROGGS I see
then we need to fix hunt_loose_adverbs_in_arglist() 19:50
timotimo i wrote that ... 19:51
nine But in what way is it broken in the first place?
19:51 beastd left
FROGGS it should put additional adverbs in a ,-list, but it does not remove the adverbs from the first Pair 19:52
and that's the issue here
nine That and the dispatch problem
19:53 xfix left
nine timotimo: adding the proto method new gives me: Cannot call new(Pair: Str, Int); none of these signatures match: (Pair $: $key, Mu \value, *%_) (Pair $: :$key, Mu :$value, *%_) 19:58
Which may actually be the cause
FROGGS m: say (Str, Int) ~~ :(Any, Mu) 20:00
camelia rakudo-moar 13f829: OUTPUT«True␤»
20:00 zakharyas joined 20:01 laouji joined 20:02 rarara joined 20:03 Ven joined
Ven m: sub bar (|args = \(1,2,3)) {...} 20:03
camelia rakudo-moar 13f829: OUTPUT«===SORRY!===␤At Frame 2, Instruction 4, op 'param_sp' has invalid number (3) of operands; needs 2.␤»
FROGGS ohh, nice one 20:04
Ven FROGGS: github.com/MoarVM/MoarVM/issues/145
FROGGS ohh, old one :/ 20:05
20:07 darutoko left 20:10 Ven left
japhb Good *, #perl6 20:12
yoleaux 4 Sep 2015 19:40Z <FROGGS> japhb: I merged C++ stuff in moar, but have to port it to jvm before I can merge the rakudo/cpp3 branch... hopefully this happens this weekend
12:29Z <FROGGS> japhb: I'm unable to merge C++ support in rakudo until it got ported to jvm... and I cannot port it as long as the jvm build is broken
japhb FROGGS: Oooh, ouch! 20:13
I've been AFK for a couple days ... what's the current state of the JVM build?
nine still broken
FROGGS aye 20:15
20:15 TEttinger joined
FROGGS and I had no luck yet in hunting it down... or gaining more information 20:15
20:18 ShimmerFairy left
TimToady is trying it without the 3 instances of statement_control:<with> to see if that makes a difference 20:19
20:20 mr-foobar left 20:21 TEttinger left, TEttinger joined 20:22 mr-foobar joined
TimToady nope, doesn't help 20:24
'with' is exonerated
20:26 virtualsue joined 20:30 telex left
nine It gets weirder and wirder. If I remove the candidate with the named arguments and make the new($key, Mu \value) a method instead of a multi method, I get a Too few positionals passed; expected 3 arguments but got 2 20:30
Which 3 arguments can a method new($key, Mu \value) expect? 20:31
FROGGS invocant + two args
20:32 ShimmerFairy joined
nine How can the invocant be missing in a method call? 20:32
20:32 telex joined
nine The first param of the callmethod op in make_pair is: QAST::Var.new( :name('Pair'), :scope('lexical') ), 20:33
20:34 leont joined 20:35 laouji left, laouji joined
FROGGS nine: and you are sure this is about Pair.new and not something else earlier or later? 20:35
nine I'm testing perl6 -e '(:a(1) :b(2))' # There is not much earlier or later. And perl6 -e '(:a(1))' works 20:36
The --ll-exception backtrace supports that 20:39
20:39 nowan left
nine Could it be that there's no Pair in lexical scope at the caller's location? 20:40
FROGGS nine: perl6 -e 'say Pair' # will tell you 20:41
20:41 nowan joined
nine (Pair) 20:44
FROGGS ohh, in (:a(1) :b(2)) the first thing results in two positionals, and in the second in one positional and one named 20:46
nine Aah, that explains it. I'm just testing making value optional 20:47
And indeed that fixes it!
So the error is indeed in the hunt_loose_adverbs_in_arglist() thing
20:48 n0tjack joined
nine Thanks for the help! 20:50
Very much appreciated
FROGGS I am working on patch currently 20:51
20:51 CQ joined 20:52 n0tjack left 20:53 CQ left
FROGGS nine: this makes it work for me: gist.github.com/FROGGS/63d711782223d28adf5d 20:53
nine: I dunno how safe it is to assume that the value is a QAST::Want... but maybe it will help you getting further at least 20:54
nine FROGGS: I'll give it a try tomorrow. Really have to go to bed now. 20:56
20:57 virtualsue left, virtualsue joined
FROGGS nine: me too, gnight 20:57
20:59 rindolf left 21:00 rindolf joined
_itz m: my @foos = q|foo|; warn @foos.WHAT 21:07
camelia rakudo-moar 13f829: OUTPUT«Use of uninitialized value <element> of type Array in string context in block <unit> at /tmp/z9EB5QwaFT:1␤Warning: something's wrong in block <unit> at /tmp/z9EB5QwaFT:1␤»
21:08 virtualsue left, virtualsue_ joined, virtualsue_ is now known as virtualsue
_itz m: my @foos = q|foo|; dd @foos 21:08
camelia rakudo-moar 13f829: OUTPUT«@foos = ["foo"]␤»
21:09 virtualsue left, virtualsue joined
TimToady m: say (1,2,4 ... *).is-lazy 21:11
camelia rakudo-moar 13f829: OUTPUT«False␤»
TimToady that seems wrong
m: say (1 .. *).is-lazy 21:12
camelia rakudo-moar 13f829: OUTPUT«True␤»
_itz m: my @foos = q|foo|; say @foos.WHAT 21:14
camelia rakudo-moar 13f829: OUTPUT«(Array)␤»
21:17 FROGGS[mobile] left 21:20 TEttinger left 21:21 virtualsue left, kaare_ left, virtualsue joined 21:22 virtualsue left, virtualsue_ joined, virtualsue_ left 21:23 rindolf left 21:31 FROGGS left
masak TimToady: feel free to submit a rakudobug. I'm a bit tied up right now. 21:35
21:42 lichtkind left
rarara m: say (1,2,4 .. *).is-lazy 21:43
camelia rakudo-moar 13f829: OUTPUT«False␤»
21:43 vendethiel left 21:45 pmurias left 21:46 zakharyas left
dalek kudo/nom: 5e1b082 | TimToady++ | src/core/operators.pm:
...* wasn't marked .is-lazy
21:46
masak ...or that. 21:47
TimToady not sure about rarara++'s example though 21:48
that sort of is a push-until-lazy example
ugexe m: my @a = ((1,2),(3,4)); my @b = @a.flatmap({ $_ }); say @b.perl 21:49
camelia rakudo-moar 13f829: OUTPUT«[(1, 2), (3, 4)]␤»
ugexe star: my @a = ((1,2),(3,4)); my @b = @a.flatmap({ $_ }); say @b.perl
camelia star-m 2015.03: OUTPUT«Array.new(1, 2, 3, 4)␤»
ugexe is the current behavior what is expected?
or should i not use flatmap 21:51
TimToady looks broken to me 21:53
or maybe it's itemizing in that case 21:54
m: my \a = ((1,2),(3,4)); my @b = a.flatmap({ $_ }); say @b.perl
camelia rakudo-moar 13f829: OUTPUT«[1, 2, 3, 4]␤»
TimToady yeah, Array itemizes, which protects from flattening 21:55
.flatmap is really only for lists
m: say (((1,2,3),4,5),6).flatmap.perl 21:56
camelia rakudo-moar 13f829: OUTPUT«Cannot call flatmap(List: ); none of these signatures match:␤ ($: &block, :$label, *%_)␤ in block <unit> at /tmp/JBKX7fqASb:1␤␤»
TimToady hmm
anyway, looks like it was supposed to be deprecated 21:57
m: say (((1,2,3),4,5),6).flat.map.perl
camelia rakudo-moar 13f829: OUTPUT«Cannot call map(Seq: ); none of these signatures match:␤ (\SELF: &block, :$label, :$item, *%_)␤ (HyperIterable:D $: &block, :$label, *%_)␤ in block <unit> at /tmp/tRzwuVlxo0:1␤␤»
TimToady m: say (((1,2,3),4,5),6).flatmap(*+1).perl 21:58
camelia rakudo-moar 13f829: OUTPUT«(4, 7).Seq␤»
TimToady m: say (((1,2,3),4,5),6).flat.map(*+1).perl
camelia rakudo-moar 13f829: OUTPUT«(2, 3, 4, 5, 6, 7).Seq␤»
TimToady and it has the wrong definition of flat anyway...
21:59 rurban1 joined 22:00 rurban left
TimToady actually, looks like it flattens after the map 22:01
it's obviously confusing, so I'd avoid it
rangerprice Where i can learn how to create an interpreter for a language ? 22:02
22:03 [Sno] left
Ulti rangerprice a language thats already well defined and old or a language you are creating? 22:07
rangerprice Ulti: both 22:11
22:11 [Sno] joined
timotimo it's a language that rangerprince is creating, but he's been creating it for 30 years now so it's already well defined 22:11
22:13 espadrine left
rangerprice hehehe 22:14
timotimo how come panda doesn't have the glr branch merged to master yet?
rangerprice www.youtube.com/watch?v=KMU0tzLwhbE 22:15
22:15 laouji left
masak rangerprice: it's hard to answer your "Where i can..." question without knowing what experience you already have. but as a general suggestion, I would go looking for source code for existing interpreters, and read and learn. 22:20
rangerprice: as someone said, an interpreter is just a switch statement in a loop :)
22:21 TEttinger joined
rangerprice masak: i'm just a developer, so i have any experience on designing a programming language but i'm very interested 22:22
TimToady masak: *everything* is just a switch statement in a loop :P
rangerprice I have a question to Perl 6 developers 22:24
Why they don't remove the "my" keyword ?! This keyword should be removed from Perl, because by default, every variable should be local.
22:25 lichtkind joined
BenGoldberg rangerprice, How would you denote when a variable comes into and goes out of scope? 22:26
masak rangerprice: it's nice to have the "my" there.
rangerprice: if variables just appear when you assign to them (like in Python and Ruby), there is a risk of typos and thinkos.
22:27 colomon joined
masak rangerprice: I'm in the same situation re experience/interest. in the past few months, I've been building a toy language called 007. (and before you ask, yes it has an interpreter.) 22:27
timotimo coffeescript people have had problems with lack of a "my"-equivalent
masak rangerprice: you might want to take a look. masak.github.io/007/ 22:28
timotimo and python people, too, with their "nonlocal" shenanigans
masak I think history will show quite clearly that lexical scoping is very nice, and that explicitly declaring your lexical variables is worth it. 22:29
it's interesting how many languages are fighting against that current, though.
timotimo masak: NoMy programming languages
TimToady -> zzz & 22:30
timotimo it's rather clearly not what you want, but people keep pushing it, because it's new and hip
and FREEDOM!
and we need the flexibility for our ridiculously short turn-arounds and our amazing agility
rangerprice BenGoldberg, i think that the "my" keyword should be implicitly use when declaring a variable. For example: when the interpreter see "$banana= 55", it should see "my $banana = 55"
timotimo schemas and defined variables only slow us down!
m: my $a = 10; my $a = $a + 5; say my $a; 22:31
camelia rakudo-moar 5e1b08: OUTPUT«5===SORRY!5===␤Cannot use variable $a in declaration to initialize itself␤at /tmp/hVAEM4Exh_:1␤------> 3my $a = 10; my $a = $7⏏5a + 5; say my $a;␤ expecting any of:␤ term␤Other potential difficulties:␤ Redeclaration of …»
timotimo like that? :)
and when someone declares a variable that's named the same as yours in some outer scope, you'll suddenly get unexpected sharing of values 22:32
like $i for a loop :P
masak rangerprice: I think the "implicitly" idea is popular but bad.
rangerprice: that's why I said it leads to typos and thinkos not being caught by the compiler. 22:33
timotimo rangerprice: and how do you put type restrictions?
masak rangerprice: that's incidentally also why I was happy to make -e strict by default in a commit last week ;)
rangerprice Everyone is clever in 2015, so its for me a lot of work to prefix my variable with the "my" keyword :( 22:34
timotimo you know, you can write a slang for that
rangerprice but i can't write anything, i'm too clever for that 22:35
TimToady is glad he's already gone to bed...
timotimo i don't understand what you mean with "clever"
rangerprice lazy * excuse me for my mistake 22:36
masak what a diligent mistake :P 22:37
22:37 rarara left
masak rangerprice: there is laziness that doesn't matter much, and there is laziness that comes back to bite you, introduces bugs, and degrades the reliability of the program 22:38
rangerprice: skipping "my" in a language is of the latter type
rangerprice: I don't see it as a cost -- I see it as a *check* that the compiler can do for me
rangerprice: typically, I forgot the "my" because I didn't think clearly about the declaration of the variable. the compiler helpfully notifies me of this. 22:39
rangerprice oh yes
masak more generally, a thing I've come to notice more and more are that many mature features come in two halves: a declaration, and a use (though they are not always called that) 22:40
think of functions vs function calls, classes vs the creation/use of classes, variable declarations vs their use 22:41
from that perspective, being able to drop the declaration of a variable ought to sound warning bells -- where did the declaration part of this feature go?
the answer (in my view) is that the user chose to skip it, and that makes it harder for the compiler to check that the program does what it should 22:42
or, put differently, the *convenience* of skipping "my" is *unhealthy*, especially for bigger programs
you don't have to agree with me -- but this is my experience :) 22:43
rangerprice I agree with you
Where i can find the source code of 007 language ? 22:44
masak github.com/masak/007
rangerprice Thanks ! 22:45
masak de nada. enjoy! 22:46
jdv79 i found another "perl" beer in rome. Perlenbacher.
rangerprice oh god 22:47
jdv79 ?
masak rangerprice: if you want to see where the interpreter is, check out github.com/masak/007/blob/master/l...ime.pm#L28 and then the .run and .eval methods in github.com/masak/007/blob/master/lib/_007/Q.pm 22:48
22:48 TEttinger left
jdv79 not bad. relatively malty like a "strong" pils. 22:49
masak jdv79: a lager?
or an actual pils?
22:50 TEttinger joined
jdv79 well. i'm not sure. that's what it tasteslike. 22:50
masak jdv79: was it this one? www.ratebeer.com/beer/lidl-perlenba...ier/60765/
22:50 TEttinger left
jdv79 no 22:51
masak ok :)
jdv79 www.ratebeer.com/beer/lidl-perlenba...ng/299380/
22:51 cognominal left
jdv79 which jibes with the taste 22:51
"imperial pils"; whatever that means 22:52
:)
22:53 TEttinger joined
masak heh :) 22:56
22:57 TEttinger left
masak yeah, it's not getting stellar reviews... 22:57
'night, #perl6
jdv79 yeah, its "ok". nothing special except the name 22:58
later
though, it doesn't deserve a score that low. 23:03
23:05 lichtkind left 23:14 AlexDaniel left 23:21 TEttinger joined 23:34 Alina-malina left 23:36 leont left 23:48 yqt left 23:55 aborazmeh joined, aborazmeh left, aborazmeh joined