»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg camelia perl6: ... | irclog: irc.perl6.org | UTF-8 is our friend!
Set by sorear on 25 June 2013.
colomon o/ 01:20
lue rosettacode.org/wiki/I_before_E_exc...r_C#Perl_6 probably not the best possible solution though :) 02:02
lue std: say uint[3]; 02:19
camelia std 09dda5b: OUTPUT«ok 00:01 123m␤»
lue r: say uint[3];
camelia rakudo-moar 535d91: OUTPUT«===SORRY!===␤Cannot find method 'parameterize'␤»
..rakudo-parrot 535d91, rakudo-jvm 535d91: OUTPUT«===SORRY!===␤No such method 'parameterize' for invocant of type 'Perl6::Metamodel::NativeHOW'␤»
TimToady lue++ 02:26
uvtc Any slides available for jnthn's "State of the Butterfly" talk? 02:34
rjbs would also be interested. 02:50
uvtc (irclog.perlgeek.de/perl6/2014-01-31#i_8202413)++ (where raydiak "contemplates putting together a list behaviour matrix which crosses parcel, list, array, capture, etc, with mutable, lazy, flattening, context-imposing, and so forth" 02:57
)
rjbs and forth? so it's a stack, too? 03:26
grondilu_ r: subset duh of Str where 'foo'|'bar'; say $_ ~~ duh for <foo baz bar meh> 03:35
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«True␤False␤True␤False␤»
uvtc I stumbled upon this, <rosettacode.org/wiki/Bitmap#Perl_6>, which seems like a rather ordinary use of OOP, but it fails with a recent perl6-m: 03:47
Type check failed in assignment
in sub infix:<=> at src/gen/m-CORE.setting:16113
in block at src/gen/m-CORE.setting:1690
in method fill at ./foo.pl6:16
in block at ./foo.pl6:35
Seems to be that line, `@.data[$i][$j] = $p.clone;` 03:48
lue rosettacode.org/wiki/Generalised_fl...t_addition <-- please tell me if it's just me that's making the table "the sequence of calculations" incomprehensible.
uvtc This is using "This is perl6 version 2014.01-19-gdc96308 built on MoarVM version 2014.01".
lue uvtc: does it work with other perl6s ? 03:49
uvtc Haven't tried. Only built Rakudo+Moar.
(I just copy/pasted the rosettacode example and thought I'd run it. Haven't poked around Perl 6 in a while.) 03:50
lue It fails in all backends, so it's not a Moar issue. 03:54
r: class Foo { }; my $a = Foo; say $a.clone.WHAT
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«(Foo)␤» 03:55
TimToady the array should not be declared to hold Pixel
it's holding refs to arrays of pixels 03:56
at least that's what [][] implies
DopeyFish r: my (@odd, @even) = (1,2,3,4).classify: {$_ % 2 ?? 'odd' !! 'even'} ; say @odd; say @even;
camelia rakudo-parrot 535d91, rakudo-moar 535d91: OUTPUT«"odd" => [1, 3] "even" => [2, 4]␤␤»
..rakudo-jvm 535d91: OUTPUT«"even" => [2, 4] "odd" => [1, 3]␤␤»
DopeyFish r: my (@odd, @even) = (1,2,3,4).classify: {* % 2 ?? 'odd' !! 'even'} ; say @odd; say @even;
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«"odd" => [1, 2, 3, 4]␤␤»
TimToady when we have shaped arrays, [;] will allow it to be declared Pixel
lue TimToady: would you use Array[Pixel] there? 03:57
TimToady I wouldn't use a type at all, fo rnow
DopeyFish Was expect * to give same result as $_ but it doesnt.
TimToady no, * implies {}, $_ doesn't
so * won't work inside {}, and $_ generally won't work outside
* % 2 is equivalent to { $_ % 2 } 03:58
so you're testing a closure for truth without calling it
DopeyFish thank you for the explanation. 03:59
TimToady yer welcome 04:00
'bout the first useful thing I've done today, besides take cough syrup... :)
lue This is... odd, to say the least: rosettacode.org/wiki/9_billion_name...alse_idols 04:15
TimToady um, yeah 04:16
sometimes he doesn't like it when people think at different abstraction levels, is how I've taken it
lue I love the danger of this one :) rosettacode.org/wiki/Machine_code 04:19
TimToady yeah, that's an odd one two, from someone who likewise gets a bee in his bonnet from time to time 04:20
*too
lue
.oO(TimToady knows what's what in RC-land)
04:21
TimToady I've looked at almost all the tasks that Perl 6 doesn't do yet 04:22
TimToady tends to leave the mathematical ones for other folks, unless there's something easy to translate
for instance, I think someone else (grondilu?) should work on rosettacode.org/wiki/Gaussian_elimination 04:23
I've also tended to avoid the two-dimensional ones (as above) in hopes that shaped arrays would come along pretty soon 04:24
from a type perspective, a 2D array is very different from an array of arrays
lue TimToady: that was one I was interested in a bit, though I got tripped up on "backwards substitution" means. :P 04:25
TimToady rakudo didn't used to check, which is why the Pixel declaration used to wrok
I'm also one of the spam admins on RC, so I see everything that goes by 04:26
TimToady so yeah, I've a bit of familiarity with RC, on a broad rather than deep level 04:26
uvtc Seems like it would be useful if all the RC entries were in a db. That way, you could ask things like, "show me all $lang entries, sorted by $last-modified-date". 04:27
lue Heh, if I bothered to go back and fix it up and make the repo public, I'd have the Execute SNUSP task completed :) 04:28
TimToady some people get distracted easily :P
lue r: my @a is LoL; say "alive!" 04:31
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Variable trait 'is TypeObject' not yet implemented. Sorry. ␤at /tmp/tmpfile:1␤------> my @a is LoL⏏; say "alive!"␤ ex…» 04:31
uvtc My only complaint with the Perl 6 entries on RC is that I'm usually hoping for a "baby Perl 6" version, but often get an experts Perl 6 version. 04:35
(at least, last time I went looking.) 04:36
TimToady often the expert version is quite readable if you know two or three things, and we sometimes try to explain those, though not often enough 04:39
TimToady and sometimes we give two different versions 04:40
BenGoldberg Speaking of RC... I recently added a perl5 RC entry, rosettacode.org/wiki/Hickerson_seri...egers#Perl , which runs vastly faster than a naive implementation of that task; does anyone want to add a perl6 version that's similarly sped up? 04:41
TimToady thing is, RC is mostly about how your language is different from other languages, and a baby talk version usually is Perl written in some other language :)
BenGoldberg: I imagine a lot of people want to *have* it added :) 04:43
BenGoldberg If I could write perl6 as well as I can read it, I'd do it myself ;)
TimToady if you wanted to add a p5ish version, I'm sure someone else would be glad to make it more idiomatic p6 04:44
uvtc TimToady, I think there's also value both in showing how languages differ as well as how they are (or can be) similar. I think it can alleviate apprehension ("oh, Perl 6 is just like $other-lang except for $this and $that"). 04:46
s/also//
TimToady sure, just sayin' RC as a whole tends to be biased towards idomaticity, not just for P6 04:47
*idio
BenGoldberg If you had the following p5 function: sub h { my ($n) = @_; return $iln2/2 if $n == 1; return $n*$iln2*h($n-1); } how would I write that as a p6 constant list?
Err, make that conditional, if $n == 0 04:48
TimToady constant h = $iln2/2, -> $prev { my $n = ++state $; $n * $iln2 * $prev } ... * 04:51
that might be one way
mixes of n and previous value tend to be difficult
BenGoldberg Hmm... 04:52
uvtc Regardless, +1 for including bits of explanation in the RC entries. :)
TimToady I'm assuming the n starts at 0 from your conditional
BenGoldberg Yes
TimToady arguably ... should provide some way to get at the current offset 04:53
so we don't have to play tricks with state 04:54
BenGoldberg p6: constant iln2 = 1 / [+] map { 1.FatRat / 2**$_ / $_ }, 1 .. 200; constant h = iln2/2, { $^prev * (++state $ ) * iln2 } ... *; say .round(.001) for h[1..4]; 04:57
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«1.041␤3.003␤12.996␤74.999␤» 04:58
..niecza v24-109-g48a8de3: OUTPUT«Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object␤ at Builtins.InvokeSub (Niecza.P6any obj, Niecza.Variable[] pos) [0x00000] in <filename unknown>:0 ␤ at Niecza.Kernel.ToComposable (Niecza.S…»
TimToady r: constant fact = 1, { $_ * ++state $ } ... *; say fact[^20]
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«1 1 2 6 24 120 720 5040 40320 362880 3628800 39916800 479001600 6227020800 87178291200 1307674368000 20922789888000 355687428096000 6402373705728000 121645100408832000␤» 04:59
TimToady r: constant fact = 1, [\*] 1..*; say fact[^20]
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«1 1 2 6 24 120 720 5040 40320 362880 3628800 39916800 479001600 6227020800 87178291200 1307674368000 20922789888000 355687428096000 6402373705728000 121645100408832000␤»
BenGoldberg r: constant fact = 0, 1, { $_ * ++state $ } ... *; say fact[^20] 05:00
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«0 1 1 2 6 24 120 720 5040 40320 362880 3628800 39916800 479001600 6227020800 87178291200 1307674368000 20922789888000 355687428096000 6402373705728000␤»
uvtc TimToady, here's an example: <rosettacode.org/wiki/Ackermann_function>. Many of the langs I checked at least show you the straightforward "C" version. But Perl 6 skips that and shows off other ways to do it. This appeals to folks who already know some Perl 6, but (IMO) turns off newbs (who *want* to see that translated C version).
BenGoldberg RC allows languages to have multiple distinct implementations of a task. 05:01
If you want to include a translated C version of the Ackermann function, you can write it and add it to the RC page, in addition to the 'perlish' solution.
lue uvtc: the ternary chaining looks to me like the C version. 05:02
TimToady uvtc: I see that; feel free to add a normal recursive version at the front
uvtc BenGoldberg, my point is that it's newbs like me who (A) would want the baby Perl 6 version, and (B) wouldn't know how to write it in P6. :)
(that is, in order to add it to the RC entry) 05:03
lue, I want the Clojure version translated to P6 right there at the top of the P6 entry. :)
lue uvtc: congratulations, the ternary chaining is at the top :P 05:04
TimToady r: constant fact = Int, -> $p is copy { $p *= ++state $; $p } ... *; say fact[^20] 05:05
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Unsupported use of $; variable; in Perl 6 please use real multidimensional hashes␤at /tmp/tmpfile:1␤------> = Int, -> $p is copy { $p *= …»
TimToady r: constant fact = Int, -> $p is copy { $p *= ++state $ ; $p } ... *; say fact[^20] 05:06
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«(Int) 1 2 6 24 120 720 5040 40320 362880 3628800 39916800 479001600 6227020800 87178291200 1307674368000 20922789888000 355687428096000 6402373705728000 121645100408832000␤»
TimToady there's another way 05:06
uvtc lue, Oh, I see what you're saying. Sorry for being unclear. I thought the ternary chaining looked more complicated than "the C version" (though I was looking at the Clojure version when I wrote that, which looks like the definiton of the thing to me.)
TimToady maybe you're really asking for the Lisp version :)
lue uvtc: the ternary is just a more cryptic if $cond { } else { if $cond2 { } else { } } 05:07
TimToady I agree, but I didn't want to upset whoever put that entry at the time by rewriting it :)
iirc
I suspect the statute of limitations has expired on that :) 05:08
if you want to make trouble, you could dig through the history, but I sure wouldn't :)
uvtc TimToady, the C/D/Lua/Clojure/etc. versions all look to my eye like direct translations of the definition at the top of the page. 05:17
TimToady sure, and will all run very slowly unless there is some kind of memoization 05:18
TimToady fixed rosettacode.org/wiki/Ackermann_function#Perl_6 for uvtc++ 05:42
raydiak gist.github.com/raydiak/8764032 # problem with overloaded at_pos breaking lvalues; dunno if it's my fatigue or a bug, but suggestions welcome 07:22
moritz raydiak: you could try to make your at_pos like this 07:31
my @res; for ... -> $i { @res[$i] := self.Array::at_pos($i) } 07:32
ie explicitly binding into the result array
no idea if it'll work
raydiak moritz: thanks, I'll give a few more explicit variants a try 07:43
raydiak yep...apparently .Array::[] silently fails as an lvalue, but .Array::at_pos works 08:15
moritz \o/ 08:23
moritz didn't even know you could write .Array::[]
oh, and you probably can't really since .[] is a subroutine
diakopter perl6: warn+map+(Fizz)[$_%3].(Buzz)[$_%5].(Bazz)[$_%7]||$_,1..100 08:25
camelia niecza v24-109-g48a8de3: OUTPUT«===SORRY!===␤␤Undeclared names:␤ 'Bazz' used at line 1␤ 'Buzz' used at line 1␤ 'Fizz' used at line 1␤␤Unhandled exception: Check failed␤␤ at /home/p6eval/niecza/boot/lib/CORE.setting line 1502 (die @ 5) ␤ at /ho…»
..rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Undeclared names:␤ Bazz used at line 1␤ Buzz used at line 1␤ Fizz used at line 1␤␤»
raydiak but .Array::[] works as an rvalue 08:29
moritz and what does it do? :-) 08:30
raydiak return the element's value...I thought...???...
r: class Foo is Array { method at_pos ($i) { die 'custom subscript' } }; my $foo = Foo.new(1,2,3); say $foo.Array::[1]; 08:32
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«2␤»
raydiak r: class Foo is Array { method at_pos ($i) { die 'custom subscript' } }; my $foo = Foo.new(1,2,3); say $foo.[1];
camelia rakudo-moar 535d91: OUTPUT«custom subscript␤ in method at_pos at /tmp/tmpfile:1␤ in sub postcircumfix:<[ ]> at src/gen/m-CORE.setting:2361␤ in sub postcircumfix:<[ ]> at src/gen/m-CORE.setting:2325␤ in block at /tmp/tmpfile:1␤␤»
..rakudo-jvm 535d91: OUTPUT«custom subscript␤ in method at_pos at /tmp/tmpfile:1␤ in sub postcircumfix:<[ ]> at gen/jvm/CORE.setting:2361␤ in sub postcircumfix:<[ ]> at gen/jvm/CORE.setting:2325␤ in block at /tmp/tmpfile:1␤␤»
..rakudo-parrot 535d91: OUTPUT«custom subscript␤ in method at_pos at /tmp/tmpfile:1␤ in sub postcircumfix:<[ ]> at gen/parrot/CORE.setting:2365␤ in sub postcircumfix:<[ ]> at gen/parrot/CORE.setting:2329␤ in block at /tmp/tmpfile:1␤␤»
raydiak r: class Foo is Array { method at_pos ($i) { die 'custom subscript' } }; my $foo = Foo.new(1,2,3); say $foo.Array::[1]; $foo.Array::[1] = 123; say $foo.Array::[1]; 08:33
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«2␤2␤»
raydiak so it's definitely calling Array's [], and doing what I expect it to, except for the silent lval fail...unless I still don't understand something pertinent 08:35
moritz raydiak: I'm asking more from a syntaxctical perspective. What exactly does .Array::[] call? 08:41
there's no method postcircumfix:<[ ]> that could be called in class Array
raydiak moritz: something magical (to me) seems to make it call one of the somethings defined in src/core/array_slice.pm, but I'm just guessing 08:42
raydiak still digging...have looked at List, Positional, Cool, and BOOTSTRAP now 08:56
raydiak okay, can't keep it all straight...bed time; this ought to be much easier to figure out with a clear head 09:05
g'night #perl6, and thanks moritz++ for the answers and challenge 09:06
Timbus r: class Foo is Array { method at_pos ($i) { die 'custom subscript' } }; my $foo = Foo.new(1,2,3); say $foo.Array.[1]; 09:27
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«2␤»
masak_ yo sup, #perl6 09:47
diakopter suuuuuuup
moritz soup! 09:48
diakopter wait, you're not masak
moritz I'm not?
moritz looks around confused 09:49
masak here I am! :) 09:49
diakopter that's better, ish
masak there must have been an IRC storm tonight. 09:50
timotimo sup! 10:00
moritz submitted a pull request for p5's Encode module
just docs, but it's already a non-wasted day :-) 10:01
masak the world, a little better. one day at a time.
ooh, new author note! \o/ 10:02
masak ...meh. progress report is "no progress". :/ 10:02
moritz :(
timotimo discovers a mash-up of rage against the machine's "killing in the name" and the thomas the tank engine theme song and is pretty pleased 10:23
tadzik :o 10:24
diakopter sung by weird al, I hope
timotimo nah, it's got the vocals from the original song 10:25
tadzik mberends! \o/ 10:29
timotimo good day mberends :) 10:31
colomon timotimo: you mean "There's two there's four there's six there's eight?" ;) 10:36
timotimo colomon: i'm not sure what that refers to 10:37
colomon timotimo: Thomas theme song words
timotimo oh
i don't actually know the thomas the tank engine words
in this case, it's the words from "killing in the name" 10:38
as in: "*choo* *choo* i won't do what you tell me!"
masak mberends! \o/ 10:39
tadzik timotimo: link? 10:47
timotimo r/thomasthedankengine 10:48
tadzik oh haha 10:49
masak clickable/permanent link: www.reddit.com/r/thomasthedankengin...st_thread/
hehe. reminds me of soundcloud.com/pomdeterrific/pomde...-me-a-hole 10:51
atroxaper Does anybody know in which system variable a path for Perl6 modules is stored? 11:35
atroxaper echo $PERL6LIB is empty 11:35
DopeyFish I got a list of arrays and is currently using map to get size of each of arrays as such: @aa.map( { +@($_) } ) 11:38
how can i replace the map block with a whatever star? 11:39
timotimo i think +@(*) ought to work (drop the { }, too)
r: my &foo = +@(*); say &foo.WHAT;
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«Type check failed in assignment to '&foo'; expected 'Callable' but got 'Int'␤ in block at /tmp/tmpfile:1␤␤»
timotimo heh.
masak r: my &foo = sub(@l) { +@l }; say &foo.WHAT 11:40
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Variable '@l' is not declared␤at /tmp/tmpfile:1␤------> my &foo = sub(@l⏏) { +@l }; say &foo.WHAT␤ expecting any of:…»
masak r: my &foo = sub (@l) { +@l }; say &foo.WHAT
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«(Sub)␤»
DopeyFish so... can't be done? 11:44
timotimo no, it definitely can 11:45
i was just too lazy to type it up
r: my @lol; @lol.push((1, 2, 3)); @lol.push((1, 2)); say @lol.perl; say @lol.map: +@(*);
camelia rakudo-moar 535d91: OUTPUT«Array.new(1, 2, 3, 1, 2)␤No such method 'count' for invocant of type 'Int'␤ in method reify at src/gen/m-CORE.setting:7322␤ in method reify at src/gen/m-CORE.setting:7235␤ in method reify at src/gen/m-CORE.setting:7235␤ in method reify at src…»
..rakudo-parrot 535d91: OUTPUT«Array.new(1, 2, 3, 1, 2)␤No such method 'count' for invocant of type 'Int'␤ in method reify at gen/parrot/CORE.setting:7326␤ in method reify at gen/parrot/CORE.setting:7243␤ in method reify at gen/parrot/CORE.setting:7243␤ in method reify a…»
..rakudo-jvm 535d91: OUTPUT«Array.new(1, 2, 3, 1, 2)␤No such method 'count' for invocant of type 'Int'␤ in method reify at gen/jvm/CORE.setting:7322␤ in method reify at gen/jvm/CORE.setting:7235␤ in method reify at gen/jvm/CORE.setting:7235␤ in method reify at gen/jvm/CO…»
timotimo oh, it flattened
r: my @lol; @lol.push($(1, 2, 3)); @lol.push($(1, 2)); say @lol.perl; say @lol.map: +@(*);
camelia rakudo-parrot 535d91: OUTPUT«Array.new($(1, 2, 3), $(1, 2))␤No such method 'count' for invocant of type 'Int'␤ in method reify at gen/parrot/CORE.setting:7326␤ in method reify at gen/parrot/CORE.setting:7243␤ in method reify at gen/parrot/CORE.setting:7243␤ in method r…» 11:46
..rakudo-moar 535d91: OUTPUT«Array.new($(1, 2, 3), $(1, 2))␤No such method 'count' for invocant of type 'Int'␤ in method reify at src/gen/m-CORE.setting:7322␤ in method reify at src/gen/m-CORE.setting:7235␤ in method reify at src/gen/m-CORE.setting:7235␤ in method reify …»
..rakudo-jvm 535d91: OUTPUT«Array.new($(1, 2, 3), $(1, 2))␤No such method 'count' for invocant of type 'Int'␤ in method reify at gen/jvm/CORE.setting:7322␤ in method reify at gen/jvm/CORE.setting:7235␤ in method reify at gen/jvm/CORE.setting:7235␤ in method reify at gen/…»
timotimo grmbl.
r: my @lol; @lol.push([1, 2, 3]); @lol.push([1, 2]); say @lol.perl; say @lol.map: +@(*);
camelia rakudo-parrot 535d91: OUTPUT«Array.new([1, 2, 3], [1, 2])␤No such method 'count' for invocant of type 'Int'␤ in method reify at gen/parrot/CORE.setting:7326␤ in method reify at gen/parrot/CORE.setting:7243␤ in method reify at gen/parrot/CORE.setting:7243␤ in method rei…»
..rakudo-moar 535d91: OUTPUT«Array.new([1, 2, 3], [1, 2])␤No such method 'count' for invocant of type 'Int'␤ in method reify at src/gen/m-CORE.setting:7322␤ in method reify at src/gen/m-CORE.setting:7235␤ in method reify at src/gen/m-CORE.setting:7235␤ in method reify at…»
..rakudo-jvm 535d91: OUTPUT«Array.new([1, 2, 3], [1, 2])␤No such method 'count' for invocant of type 'Int'␤ in method reify at gen/jvm/CORE.setting:7322␤ in method reify at gen/jvm/CORE.setting:7235␤ in method reify at gen/jvm/CORE.setting:7235␤ in method reify at gen/jv…»
timotimo is that so?
r: my @lol; @lol.push([1, 2, 3]); @lol.push([1, 2]); say @lol.perl; say @lol.map: *.elems;
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«Array.new([1, 2, 3], [1, 2])␤3 2␤»
DopeyFish found it. 11:59
@aa.map(+*) 12:00
DopeyFish r: my @lol; @lol.push($(1, 2, 3)); @lol.push($(1, 2)); say @lol.perl; say @lol.map(+*) 12:00
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«Array.new($(1, 2, 3), $(1, 2))␤3 2␤»
timotimo ah sure 12:01
no need to @(...) that
masak perl6: my &foo = sub ($x) { say "one parameter" }; foo("OH"); &foo = sub ($y, $z) { say "two parameters" }; foo("OH", "HAI") 13:58
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«one parameter␤two parameters␤»
..niecza v24-109-g48a8de3: OUTPUT«Potential difficulties:␤ $x is declared but not used at /tmp/tmpfile line 1:␤------> my &foo = sub (⏏$x) { say "one parameter" }; foo("OH"); ␤ $y is declared but not used at /tmp/tmpfile line 1:␤------> ne parameter…»
masak sometimes it feels weird to declare accumulator-type variables outside of the loop where they're to be used. 14:10
and it doesn't feel like there's a phaser to help with that either. 14:11
I guess what I am thinking of is some kind of 'state' declaration for loops.
Timbus oh wow, thats something ive always wanted too :o 14:16
clsn perl6: my $i=0; while $i < 6 { LEAVE { last }; say $i++; } 14:17
camelia rakudo-parrot 535d91: OUTPUT«===SORRY!===␤Error while compiling op p6return: Operation 'p6return' requires 1 operands, but got 2␤»
..rakudo-jvm 535d91, rakudo-moar 535d91, niecza v24-109-g48a8de3: OUTPUT«0␤»
masak clsn: ooh 14:17
clsn: haven't seen that one before. 14:18
clsn Yeah, looked weird to me too...
masak clsn: feel free to submit a rakudobug.
clsn Will in a bit.
masak Timbus: actually, I think this all ties into the "lagging-variable" package.
clsn I'm a little fuzzy on some of the phasers in general...
masak Timbus: maybe I should write a module for that just to get it out of my system.
clsn: that one is interesting, for sure.
clsn perl6: my $i=0; while $i < 6 { FIRST { say "Here"; last }; say $i++ }
camelia rakudo-moar 535d91: OUTPUT«0␤1␤2␤3␤4␤5␤» 14:19
..niecza v24-109-g48a8de3: OUTPUT«===SORRY!===␤␤Action method statement_prefix:FIRST not yet implemented at /tmp/tmpfile line 1:␤------> hile $i < 6 { FIRST { say "Here"; last }⏏; say $i++ }␤␤Unhandled exception: Unable to resolve metho…»
..rakudo-parrot 535d91, rakudo-jvm 535d91: OUTPUT«Here␤0␤1␤2␤3␤4␤5␤»
masak clsn: it's another one of those "how does X interact with Y" things. phasers are full of them.
clsn Wow, didn't expect moar to do different there.
Timbus i guess you could always use the first part of a loop(;;) ;/
clsn I'm not positive that the behavior is wrong or right there...
masak clsn: looks like rakudo-parrot has it right. 14:20
hm, wait.
clsn Does the "last" not count there then?
masak no, none of them are right.
yes, it should, of course.
clsn: feel free to submit a separate rakudobug for that one. ;)
clsn Heh. :)
Timbus call it 'the last bug' and we can declare perl 6 finished when it's closed 14:22
clsn Ooh, I like that.
virtualsue o/ 15:10
masak virtualsue: \o 15:12
timotimo ohai
virtualsue greets 15:14
FROGGS o/ 15:16
rindolf Hi all, masak, timotimo , FROGGS 15:31
FROGGS hi rindolf
rindolf FROGGS: what's new?
FROGGS I dunno
this is news to me: fosdem.org/2014/schedule/event/perl6_today/
and I hope it does not takes months for the videos to appear
timotimo saturday ... so it happened already 15:32
timotimo looks forward to slide uploads
TimToady unfortunately, they didn't turn down the unused wireless mic channel, and there is occasional static that is louder than jnthn++ 15:33
timotimo aaw crud :(
virtualsue i'm hoping the video will be good
FROGGS TimToady: well, he can speak it again at home :o) 15:35
TimToady of course, I'm just guessing that's what happened, but sound engineer is one of the jobs I know how to fake pretty well 15:37
FROGGS Sqirrel \o/ 15:45
abraxxa I've written a little app in Perl 6 two years ago and just found out that it has a bug with the current Rakudo Star 2014.01 release: gist.github.com/abraxxa/806301 15:54
the input check in line 51 and 56 accept number that aren't included in @allowed_numbers and @allowed_stars and I wonder if my code is correct or the release has a bug 15:55
timotimo i think you may want to use == instead of ~~ for those checks 15:57
the any will autothread the == comparison over all of its members anyway
oh, actually
your alloced_numbers and allowed_stars could just be actually ranges (i think assignment to a @var will listify them), and *then* you can use ~~ without any 15:58
FROGGS p: my @allowed_numbers = (1..50); say 55 ~~ any @allowed_numbers 15:59
camelia rakudo-parrot 535d91: OUTPUT«False␤»
timotimo p: my @allowed_numbers = 1..50; say @allowed_numbers.WHAT
camelia rakudo-parrot 535d91: OUTPUT«(Array)␤»
timotimo ~~ should still work on that, but it would be less efficient
TimToady timotimo: allowed is a random subset though 16:00
timotimo oh, i didn't notice that
it's kind of hard, since the lines are wider than gist will show at once >_> 16:01
abraxxa i wonder if the (my $input = prompt) returns $input or something else
TimToady why is it testing && $input !~~ any @numbers ?
FROGGS it will return the value of $input, yes 16:02
timotimo it should return that, yeah
abraxxa TimToady: to not allow the same number twice
TimToady wuold that not disallow any of the picked numbers the first part allowed
abraxxa yes
that's the point of it
a user pick without return 16:03
TimToady sorry, not awake enough yet to help 16:04
not to mention the flu, and the trigeminal shingles I'd better go to the doctor for this morning...
abraxxa hm...weird
> say (my $input = prompt("Bitte geben sie Stern $_ ein (1-9): ")) ~~ 1..9;
Bitte geben sie Stern ein (1-9): 10
True
timotimo hm. it may be problematic since what prompt returns is a string 16:05
so it sees that it begins with a 1 and says "that's okay"?
FROGGS perl6-p -e 'say (my $input = prompt("Bitte geben sie Stern $_ ein (1-9): ")).Int ~~ 1..9'
Bitte geben sie Stern ein (1-9): 22
False
abraxxa TimToady: get well soon! I've been ill last week two, for the fifth time this winter...
timotimo FROGGS: what happens if you supply "foo" instead? :)
abraxxa ah! 16:06
timotimo r: say "foo".Int
camelia rakudo-parrot 535d91: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏foo' (indicated by ⏏)␤ in method Int at gen/parrot/CORE.setting:12223␤ in method Int at gen/parrot/CORE.setting:5530␤ in block at /tmp/tmpfile:1␤␤»
..rakudo-jvm 535d91: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏foo' (indicated by ⏏)␤ in method Int at gen/jvm/CORE.setting:12202␤ in method Int at gen/jvm/CORE.setting:5526␤ in block at /tmp/tmpfile:1␤␤»
..rakudo-moar 535d91: OUTPUT«===SORRY!===␤Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏foo' (indicated by ⏏)␤»
abraxxa did this change in the last year in rakudo star?
TimToady I'll get over the flu on my own, but if I don't deal with this shingles, I could well get Bell's Palsy
FROGGS timotimo: that :o)
abraxxa cause that did work when i first wrote it
FROGGS say "22" ~~ 1..9
p: say "22" ~~ 1..9 16:07
camelia rakudo-parrot 535d91: OUTPUT«True␤»
FROGGS n: say "22" ~~ 1..9
camelia niecza v24-109-g48a8de3: OUTPUT«False␤»
FROGGS clearly a rakudobug
abraxxa looks like we're up to something 16:07
timotimo r: say "foo" ~~ 1..9
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«False␤» 16:08
abraxxa every time I run this little app with a newer rakudo version I find a bug ;)
but it's only about once a year
timotimo at least that doesn't give an exception
abraxxa: your contributions are helpful :)
TimToady p: say "2" ~~ any(1,2,3)
camelia rakudo-parrot 535d91: OUTPUT«True␤»
TimToady abraxxa: obviously if you ran this more often, we'd be done by now :)
timotimo :D 16:09
abraxxa but that seems to work here: > say "51" ~~ any(1..50);
False
FROGGS n: say "22" ~~ any 1..9
camelia niecza v24-109-g48a8de3: OUTPUT«False␤»
FROGGS p: say "22" ~~ any 1..9
camelia rakudo-parrot 535d91: OUTPUT«False␤»
FROGGS hmmmm
FROGGS weird 16:10
abraxxa tries to find a spectest where he could add some more 16:12
rakudo/t/spec/S03-smartmatch/any-array.t looks promising 16:13
TimToady I thought it was bare range check that was malfing 16:14
r: say "22" ~~ 1..9
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«True␤»
abraxxa what's the perl6 counterpart of prove -vl ? 16:15
hm, two of the existing tests in there fail 16:16
abraxxa runs make rakudo-spectest
timotimo it's "spectest" (or, if you have multiple backends built p-spectest for example)
abraxxa make test told me to run make rakudo-spectest 16:17
which works
timotimo oh
okay
abraxxa and quite a few fail
not sure if that's ok because some features aren't implemented or bugfree
timotimo the ones that fail should actually be fudged properly 16:18
abraxxa e.g. t/spec/S02-lexical-conventions/unicode.rakudo.parrot ............ Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
timotimo (and have a proper ticket)
that's when it "crashes"
abraxxa that happened three times so far
FROGGS that is unusual 16:19
timotimo try running these with just perl6 rather than prove so you'll get the output
maybe your build has had some problem?
abraxxa just compiled it on Ubuntu 13.10 x86-64 wihtout any problems
timotimo i'd call that test crashing a problem, though 16:20
abraxxa i've built it with perl Configure.pl --gen-parrot --gen-nqp --backends=parrot as i didn't want the jvm backend 16:21
FROGGS abraxxa: that is alright
can we get your perl6-p --version ?
abraxxa hm...i have the libicu48 ubuntu package installed but no -dev one 16:22
FROGGS ahh, that explains it
abraxxa might that cause the compile to succeed but leaving the binary with weird features?
timotimo yeah
FROGGS though, the tests should be skipped when icu is missing 16:22
abraxxa the build process should prevent that from happening
timotimo as soon as you try to use unicode database stuff, it'll tell you that icu is missing
abraxxa FROGGS: This is perl6 version 2014.01 built on parrot 5.9.0 revision 0 16:23
FROGGS k, thx
abraxxa makes sense
abraxxa still t/spec/S02-types/version.t ...................................... Failed 6/35 subtests 16:23
and the failing in my code shouldn't be unicode related either 16:24
timotimo aye
abraxxa i'll build another one with libicu48-dev installed for comparision
FROGGS abraxxa: if we can't solve that now, I'll drop you a msg via github or will comment to your gist with a solution 16:26
abraxxa should i paste the full output of the non-icu build's make rakudo-spectest?
FROGGS no, don't think we need that
abraxxa ok
after installing libicu-dev the Configure script fails
FROGGS I can test that here too
that is a bug in parrot 16:27
I think you need to create the following symlink: /usr/include/unicode -> /usr/include/x86_64-linux-gnu/unicode/
abraxxa yes, now it continues 16:29
should be added to rakudo.org/how-to-get-rakudo/ or the README 16:30
timotimo the new parrot version that we neglected to upgrade to ... did it fix that?
abraxxa sorry, the README includes it
timotimo in that case, i'll bump the parrot version for the release i'll be doing this month
FROGGS timotimo: no, don't think so
timotimo but the parrot folks do know about it? 16:31
abraxxa can i build it using more than one core? 16:32
FROGGS timotimo: possibly, but not sure about that
timotimo: I wanted to fix that, but had not time to do that yet
timotimo abraxxa: parrot, yes. rakudo, partially, nqp also only partially
abraxxa with which option?
FROGGS abraxxa: make -j3 for example
abraxxa ah, so nothing special
can i pass that to Configure as well? 16:33
timotimo i don't think so
FROGGS no
abraxxa hm...that doesn't help much 16:35
timotimo yes, most of the build is actually sequential
abraxxa looks like the tests as well 16:38
timotimo for that you need TEST_JOBS=n 16:39
abraxxa ah yes 16:40
i had that set in my bashrc but commented it out because of random cpan module failure
TEST_JOBS=10 makes my eight cores to 100%
timotimo 8 should be enough, too :)
abraxxa that's quite a memory hugger 16:41
timotimo yes, it is
moarvm is pretty promising in that regard, though
abraxxa looking forward to it! 16:42
Files=777, Tests=30268, 344 wallclock secs ( 8.02 usr 1.29 sys + 2336.52 cusr 160.69 csys = 2506.52 CPU) 16:46
Result: PASS
timotimo not such a bad timing 16:47
abraxxa the bug in my app is still present 16:49
FROGGS abraxxa: it is a problem with precedence 17:00
you need either any(@allowed_numbers), or replace && by 'or' 17:01
err, 'and'
p: say( "ohh" ~~ any 1 && 2 )
camelia rakudo-parrot 535d91: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏ohh' (indicated by ⏏)␤ in method Numeric at gen/parrot/CORE.setting:12225␤ in sub infix:<==> at gen/parrot/CORE.setting:4049␤ in sub infix:<==> at gen/p…»
FROGGS p: say( "55" ~~ any 1 && 2 ) 17:02
camelia rakudo-parrot 535d91: OUTPUT«False␤»
FROGGS umm
p: say( "55" ~~ any True )
camelia rakudo-parrot 535d91: OUTPUT«True␤»
FROGGS well, in the end it is like the above
abraxxa with TEST_JOBS=4: Files=777, Tests=30268, 411 wallclock secs ( 6.35 usr 0.93 sys + 1474.16 cusr 120.76 csys = 1602.20 CPU) 17:07
so hyperthreading is useful 17:08
timotimo yeah, an extra register bank and (maybe?) extra L1 cache will definitely help
most of the benefit comes from having the pipeline stuffed all the time, i believe
abraxxa yes
i'll try again with 8 jobs now to see if 8 -> 10 gives any substantial advantages 17:09
411 -> 344 secs is nice though
16,3% faster 17:10
timotimo if you like the speed, why not try 1) measuring the exact memory usage with /usr/bin/time and 2) running moarvm with that many jobs :)
abraxxa i wanted to wait until a rakudo-star release with moarvm is available 17:13
timotimo i suppose that's prudent
abraxxa TEST_JOBS=8 Files=777, Tests=30268, 339 wallclock secs ( 7.96 usr 1.18 sys + 2301.31 cusr 159.43 csys = 2469.88 CPU) 17:14
i wonder why $input == any(1..50) fails 17:16
timotimo r: print any(1..50); 17:17
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«any(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50)»
abraxxa it returns an any object of True/False values where the 39th is True, all others False
timotimo right, that should boolify to True 17:18
abraxxa say 'true' if "39" == any(1..38) 17:19
returns Nil
say 'true' if "39" == any(1..39)
returns true
so that works
timotimo mhh
abraxxa so it's just the precedents problem that seems to have changed/fixed in the last year or so
updated the gist, works now 17:21
FROGGS: thanks
TEST_JOBS=6 17:22
Files=777, Tests=30268, 352 wallclock secs ( 6.97 usr 0.96 sys + 1898.13 cusr 139.15 csys = 2045.21 CPU)
4C/8T sandy bridge cpu
time's output: 1910.14user 142.04system 5:58.89elapsed 571%CPU (0avgtext+0avgdata 772116maxresident)k 17:23
0inputs+10360outputs (0major+91996352minor)pagefaults 0swaps
timotimo oh, that's only like 120 megabytes of RAM per fork 17:23
that's not terribly
bad
abraxxa system monitored showed between 400 and 600megs
timotimo it had seemed to me like rakudo-parrot will already spend about 200 megabytes of ram for just "say 1" 17:24
abraxxa moarvm's readme on github says i can do --gen-moar but this isn't recognized by the rakudo-star 2014.01 release 17:27
timotimo oh? maybe that only goes for nqp?
try with --backends=parrot,moar --gen-nqp
abraxxa Unknown backend 'moar'; Supported backends are: jvm, parrot 17:28
timotimo ah, hm, okay
in that case, no moar for you
abraxxa i'll wait until it's included in rakudo-star 17:29
thanks for the help
timotimo yeah, that's all right
sergot Could somebode tell me how to initialize private field in new method? 18:36
timotimo self!private_field = 123 18:37
should/could work
er, not really "self"
more like my $result = self.bless(....); $result!private_field = 123
sergot Is it better to use submethod BUILD to do that?
timotimo method new will not be called by any child methods "new" unless you explicitly do it that way 18:38
sergot r: class A { has $!t; method new($test) { my $RES = self.bless(); $RES!t = $test; } }; my $a = A.new; 18:40
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤No such private method 't' for invocant of type 'A'␤at /tmp/tmpfile:1␤------> w($test) { my $RES = self.bless(); $RES!⏏t = $te…»
timotimo oh? 18:41
it might be spelled differently?
like $RES!$!t? that doesn't seem right
psch hi #perl6 18:42
sergot hi psch o/
sergot r: class A { has $!t; method new($test) { my $RES = self.bless(); $RES!$!t = $test; } }; my $a = A.new; 18:43
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Cannot use this form of method call with a private method␤at /tmp/tmpfile:1␤------> test) { my $RES = self.bless(); $RES!$!t⏏ …»
sergot timotimo: so, maybe BUILD is better? :) 18:43
timotimo in build you have direct access to the private attributes
sergot timotimo: that's what I need, I think. 18:45
psch sergot: what are you trying to do? 18:46
the log says "initialize private field in new", which works with the inherited .new()
m: class A { has $!foo; method getFoo { self!foo } }; A.new(:foo("test")).getFoo.say
camelia rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/ts08DQQ44T␤No such private method 'foo' for invocant of type 'A'␤at /tmp/ts08DQQ44T:1␤------> ass A { has $!foo; method getFoo { self!⏏foo } }; A.new(:foo("test")).getFoo.say…»
psch or does it
setting it works, but getting it didnt there :/ 18:47
m: class A { has $!foo; method getFoo { $.foo } }; A.new(:foo("test")).getFoo.say # like this i think
camelia rakudo-moar 535d91: OUTPUT«No such method 'foo' for invocant of type 'A'␤ in method getFoo at /tmp/W_QOos412u:1␤ in block at /tmp/W_QOos412u:1␤␤»
psch nope, nevermind
those twigils are definitely complicated :P
sergot In fact, I have two problems.
timotimo private attributes are not part of the public interface 18:48
that's why you can't set them via an autogenerated new method
sergot The first one is, that I want to run inherited new() method, to initialize some of inherited public fields.
sergot The second one is that I want to initialize a private field. 18:49
raiph timotimo: does/could rakudo tweast? www.lrde.epita.fr/dload/papers/dem...09.sac.pdf 18:50
psch timotimo: right, .new takes any named parameter i just noticed
timotimo i'm not the right one to ask :P
psch: all methods do 18:51
psch oh okay
sergot Is submethod BUILD being inherited? 18:52
timotimo i think submethods never are 18:52
but BUILDALL calls all BUILD methods, no?
sergot r: class A { submethod BUILD(){ say 'HEY'; } }; class B is A {}; my $b = B.new; 18:53
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«HEY␤»
sergot Right, it is.
sergot So,it could be what I need to solve the first problem. 18:54
psch sergot: S12 says "you must write your own BUILD in order to present private attributes as part of your initialization API", which i take to mean your solution is the intended one 18:57
sergot r: class A { has $.v; method new() { say 'OH HAI!'; $.v = 'test'; } }; class B is A {}; my $b = B.new; say $b.v; 18:58
camelia rakudo-jvm 535d91: OUTPUT«OH HAI!␤Cannot look up attributes in a type object␤ in method v at gen/jvm/CORE.setting:2771␤ in method new at /tmp/tmpfile:1␤ in block at /tmp/tmpfile:1␤␤»
..rakudo-parrot 535d91: OUTPUT«OH HAI!␤Cannot look up attributes in a type object␤ in method v at gen/parrot/CORE.setting:2778␤ in method new at /tmp/tmpfile:1␤ in block at /tmp/tmpfile:1␤␤»
..rakudo-moar 535d91: OUTPUT«OH HAI!␤Cannot look up attributes in a type object␤ in method v at src/gen/m-CORE.setting:2771␤ in method new at /tmp/tmpfile:1␤ in block at /tmp/tmpfile:1␤␤»
sergot psch++ thanks, that's what I need :)
r: class A { has $.v; method new() { say 'OH HAI!'; my $v = 'test' ;self.bless(:$v); } }; class B is A {}; my $b = B.new; say $b.v; 18:59
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤test␤»
dalek kudo-star-daily: 99e67d4 | coke++ | log/ (5 files):
today (automated commit)
18:59
sergot r: class A { has $.v; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); } }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:00
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤»
sergot thanks for help everyone. :) 19:01
sergot r: class A { has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; submethod BUILD() { $!p = 'p'; } }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:04
camelia rakudo-parrot 535d91: OUTPUT«OH HAI!␤use of uninitialized value of type Any in string context in block at /tmp/tmpfile:1␤␤v: ␤»
..rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤use of uninitialized value of type Any in string context␤v: ␤»
sergot r: class A { has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:05
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤»
sergot r: class A { has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; submethod BUILD() {} }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:07
camelia rakudo-parrot 535d91: OUTPUT«OH HAI!␤use of uninitialized value of type Any in string context in block at /tmp/tmpfile:1␤␤v: ␤»
..rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤use of uninitialized value of type Any in string context␤v: ␤»
sergot r: class A { submethod BUILD(){}; has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v;
camelia rakudo-parrot 535d91: OUTPUT«OH HAI!␤use of uninitialized value of type Any in string context in block at /tmp/tmpfile:1␤␤v: ␤»
..rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤use of uninitialized value of type Any in string context␤v: ␤»
sergot Why does it now work with submethod BUILD?
not* 19:08
psch B has only the default BUILD i think
because submethods aren't inherited
...but then $.v is public and should be covered by that :/
maybe dropping a submethod inside the inheritance chain covers Mu.BUILD? 19:09
sergot Hmm
timotimo is not completely competent WRT BUILD and new and BUILDALL :(
sergot :( 19:10
moritz when you define a BUILD, you have to take care of attribute initialization 19:11
even of public attributes
sergot r: class A { submethod BUILD($.v){ $.v = 'test'; }; has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:12
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Virtual call $.v may not be used on partially constructed objects␤at /tmp/tmpfile:1␤------> class A { submethod BUILD($.v){ $.v⏏[3…»
sergot r: class A { submethod BUILD(){ $.v = 'test'; }; has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:13
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Virtual call $.v may not be used on partially constructed objects␤at /tmp/tmpfile:1␤------> class A { submethod BUILD(){ $.v⏏ …»
sergot moritz: could You tell me how? 19:14
I this case I shouldn't do any initialization in new? 19:15
moritz 1) BUILd expects positional arguments
2) you can't assign to $.v, just to $!v
vendethiel I think there was a conference this weekend ? I saw a link posted but I lost it, does somebody have records ?
sergot r: class A { submethod BUILD(){ $!v = 'test2'; }; has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:15
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test2␤» 19:16
sergot moritz++ thanks
moritz vendethiel: yes, FOSDEM
moritz and irc.perl6.org has all the links :-) 19:17
sergot moritz: If I use BUILD submethod I shouldn't initialize anything in new?
timotimo moritz: BUILD expects *positional* arguments?
psch S12 examples with BUILD(:$!foo, :$!bar) { } as a short-hand for BUILD(:$foo is copy, :$bar is copy) { $!foo := $foo; $!bar := $bar } - i suspect moritz++ braino'd 19:18
sergot r: class A { submethod BUILD(:$!v){ }; has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:19
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤»
sergot psch++ moritz++ thanks :)
[Coke] OT: /me hurls www.kickstarter.com/projects/14880...s-magazine for people who like scifi, games, and magazines. (I know the guy) 19:20
(one of the guys, anyway)
colomon [Coke]: combining board game and SF magazine seems like an odd choices? 19:22
clsn Are @-variables supposed to hold Arrays, or Positionals? Because it seems they'll only hold Arrays. 19:22
moritz they can hold non-Array Positionals just fine 19:24
moritz m: my @a = (1, 2, 3); say @a.^name 19:24
camelia rakudo-moar 535d91: OUTPUT«Array␤»
moritz m: my @a := (1, 2, 3); say @a.^name
camelia rakudo-moar 535d91: OUTPUT«Parcel␤»
sergot r: class A { submethod BUILD(:$!v, :$!p){ $!p = 'a'; }; has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A {}; my $b = B.new; say 'v: ' ~ $b.v; 19:24
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤»
sergot r: class A { submethod BUILD(:$!v, :$!p){ $!p = 'a'; }; has $.v; has $!p; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A { method h() { say 'p: ' ~ $!p } }; my $b = B.new; say 'v: ' ~ $b.v; 19:25
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Attribute $!p not declared in class B␤at /tmp/tmpfile:1␤------> is A { method h() { say 'p: ' ~ $!p } }⏏; my $b = B.new; say …»
sergot Can I inherit a private field? 19:26
timotimo only from roles, i think? 19:27
TimToady which is not inheriting, of course 19:27
timotimo fair enough
TimToady so basically no :)
timotimo TimToady: i seem to recall there was some way to access the private attributes of a variable that has "your own" type, but isn't `self`, right? 19:28
or was that only for private methods?
TimToady yes, as long as you're in the identical class 19:29
moritz only knows the syntax for private methods
TimToady but you still have to name the exact class, $other!MyClassName::foo()
timotimo ah, that's methods, not attributes, though?
TimToady I think it works for attrs too
timotimo OK
TimToady thing is, all private method calls are really just sub calls in disguise 19:30
timotimo .o(that's also why they are pretty optimal)
TimToady but I think it generates the sub calls for attrs too
sergot r: class A { submethod BUILD(:$!v){ }; has $.v; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A { method new() { }; }; my $b = B.new; say 'v: ' ~ $b.v;
timotimo hm, sub calls for attrs doesn't immediately seem optimal
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«No such method 'v' for invocant of type 'Any'␤ in block at /tmp/tmpfile:1␤␤»
moritz timotimo: for attributes, where would the sigil go?
sergot r: class A { submethod BUILD(:$!v){ }; has $.v; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A { method new() { callsame; }; }; my $b = B.new; say 'v: ' ~ $b.v;
timotimo i seem to recall we turn $!foo into getattr/setattr
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤»
timotimo moritz: that's the question; probably after ::? 19:31
TimToady that's never right
only thing after :: allowed is ()
sergot r: class A { submethod BUILD(:$!v){ }; has $.v; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A { has $.newfiled; method new() { callsame; }; }; my $b = B.new; say 'v: ' ~ $b.v;
TimToady for symbolic refs
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤»
sergot How can I initializ $.newfiled ?
initialize*
timotimo oh, hm
sergot $.newfiled* 19:32
ahh... $.newfield
TimToady um, a new with a callsame is never gonna be the right thing
moritz sergot: with a submethod BUILD in B, for example 19:33
or a default value
also, if you don't do anything noteworthy in new, there's not point in having one anyway
timotimo TimToady: will perl6 ever be the right thing? :P 19:34
TimToady is a moderate
sergot moritz: I want to get all inherited fields (with inherited initialization) + initialize some not inherited. Which way is the best to do that? 19:35
clsn Ah. class G does Positional { }; my @t:=G.new works (puts a G in @t). Using = instead of := doesn't (it's an Array). Has to do with how @ vars get assigned, OK. 19:37
moritz sergot: the easiest is still to put defaults directly on the attribute declaration 19:37
has $.b; has $.c = $!a * 2; has $.d = 42; 19:38
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A { has $.newfiled = 42 }; my $b = B.new; say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled; 19:39
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤newfiled: 42␤»
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A { has $.newfiled = 42 }; my $b = B.new(:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled; 19:40
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤newfiled: 42␤»
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new() { say 'OH HAI!'; my $v = 'test'; self.bless(:$v); }; }; class B is A { has $.newfiled }; my $b = B.new(:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled;
camelia rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤use of uninitialized value of type Any in string context␤newfiled: ␤»
..rakudo-parrot 535d91: OUTPUT«OH HAI!␤v: test␤use of uninitialized value of type Any in string context in block at /tmp/tmpfile:1␤␤newfiled: ␤»
sergot moritz: I can't do that. My new takes raw string, gets some values from there and then uses them to initialize public fields. But maybe... Can I achieve calling method like this: m(a => 2), in another way than *% in declaration? 19:43
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new() { say 'OH HAI!'; nextwith(:v<test>); }; }; class B is A { has $.newfiled }; my $b = B.new(:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled;
camelia rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤use of uninitialized value of type Any in string context␤newfiled: ␤»
..rakudo-parrot 535d91: OUTPUT«OH HAI!␤v: test␤use of uninitialized value of type Any in string context in block at /tmp/tmpfile:1␤␤newfiled: ␤»
moritz sergot: I don't see wha tcalling methods with named arguments and *% declarations have to do with each other 19:44
[Coke] colomon: (odd choice) litle bit, yah. 19:45
moritz sergot: and keep in mind that non-trivial contructors are always going to make inheritance harder
raiph .tell masak "program transformation, optimization, instrumentation, etc [by] generating and rewriting ASTs ... can become tedious and hard to maintain ... . On the other hand, concrete syntax provides a natural and simpler representation of programs" (from www.lrde.epita.fr/dload/papers/dem....sac.pdf); I assume similar issues apply to 19:46
macros; was curious what your comments might be
yoleaux raiph: I'll pass your message to masak.
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new() { say 'OH HAI!'; nextwith(:v<test>); }; }; class B is A { has $.newfiled }; my $b = B.new(:v('do you see me?'),:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled;
camelia rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: test␤use of uninitialized value of type Any in string context␤newfiled: ␤»
..rakudo-parrot 535d91: OUTPUT«OH HAI!␤v: test␤use of uninitialized value of type Any in string context in block at /tmp/tmpfile:1␤␤newfiled: ␤»
TimToady I'd think nextwith to the default new should see those :v arguments
r: class A { submethod BUILD(:$!v){ }; has $.v; method new(*%_) { say 'OH HAI!'; nextwith(|%_)); }; }; class B is A { has $.newfiled }; my $b = B.new(:v('do you see me?'),:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled; 19:48
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Unable to parse expression in block; couldn't find final '}' ␤at /tmp/tmpfile:1␤------> new(*%_) { say 'OH HAI!'; nextwith(|%_)⏏[…»
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new(*%_) { say 'OH HAI!'; nextwith(|%_); }; }; class B is A { has $.newfiled }; my $b = B.new(:v('do you see me?'),:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled;
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: do you see me?␤newfiled: 43␤»
sergot moritz: If I think correctly, unfortunately I can't use trivial new method.
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new(*%_) { say 'OH HAI!'; nextwith(:v<test>, |%_); }; }; class B is A { has $.newfiled }; my $b = B.new(:v('do you see me?'),:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled; 19:49
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«OH HAI!␤v: do you see me?␤newfiled: 43␤»
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new(*%_) { say 'OH HAI!'; nextwith(|%_, :v<test>); }; }; class B is A { has $.newfiled }; my $b = B.new(:v('do you see me?'),:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled; 19:50
camelia rakudo-jvm 535d91: OUTPUT«OH HAI!␤v: test␤newfiled: 43␤»
..rakudo-moar 535d91: OUTPUT«OH HAI!␤v: do you see me?␤newfiled: 43␤»
..rakudo-parrot 535d91: OUTPUT«OH HAI!␤duplicate named argument in call␤ in method new at /tmp/tmpfile:1␤ in block at /tmp/tmpfile:1␤␤»
TimToady ooh, differences!
psch what does niecza say?
timotimo what does the pugs say? 19:50
TimToady n: class A { submethod BUILD(:$!v){ }; has $.v; method new(*%_) { say 'OH HAI!'; nextwith(|%_, :v<test>); }; }; class B is A { has $.newfiled }; my $b = B.new(:v('do you see me?'),:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled;
camelia niecza v24-109-g48a8de3: OUTPUT«OH HAI!␤v: test␤newfiled: 43␤»
TimToady niecza appears to agree with jvm 19:51
pugs: class A { submethod BUILD(:$!v){ }; has $.v; method new(*%_) { say 'OH HAI!'; nextwith(|%_, :v<test>); }; }; class B is A { has $.newfiled }; my $b = B.new(:v('do you see me?'),:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled;
camelia pugs: OUTPUT«OH HAI!␤*** No such subroutine: "&nextwith"␤ at /tmp/7HvKSEUhE9 line 1, column 79-102␤»
TimToady that's what pugs says :)
timotimo :(
TimToady these days pugs is...venerable... 19:54
psch so that means that moar doesn't go via A.new and parrot does a mix of nextsame and nextwith, while jvm and niecza do it correctly? 20:03
timotimo the OpenPandora successor, the Pyra, could be a nice system to do MoarVM ARM development on 20:05
its two powerful cores run at up to 1.7 ghz and it'll probably have 2 gigabytes of ram
TimToady moar seems to be acting like I called nextsame instead of nextwith 20:06
psch oh, right 20:07
colomon Has anyone tried Moar on Raspberry Pi? 20:10
sergot So, I'm not able to easily initialize a private field in a constructor using a named argument of new() [which name is not the same as the private field]. Am I right?
e.g.:
sergot r: class A { has $!a; has $.b; method new($b){ self.bless(:$b) } }; my $a = A.new; # I want object to have $!a initialized here. 20:11
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«Not enough positional parameters passed; got 1 but expected 2␤ in method new at /tmp/tmpfile:1␤ in block at /tmp/tmpfile:1␤␤»
sergot r: class A { has $!a; has $.b; method new($b){ self.bless(:$b) } }; my $a = A.new("a"); # I want object to have $!a initialized here.
camelia ( no output )
moritz colomon: moar compiled fine on the rpi last I tried, but NQP on moar doesn't 20:13
sergot r: class A { has $!a; has $.b; method new($b){ self.bless(:$b) } }; my $a = A.new("a"); # say $a.print_b; # I want object to have $!a initialized here. It should use $.b value to set $!a;
camelia ( no output )
psch m: class A { has $!a; has $.b; method getA { $!a }; submethod BUILD(:$!a, :$!b) { } }; A.new(:a("a"), :b("b")).getA.say;
camelia rakudo-moar 535d91: OUTPUT«a␤»
psch sergot: ^^
colomon moritz: think it's a bit thing or a little thing?
moritz colomon: iirc, moar simply doesn't support 32bit CPUs 20:15
sergot psch: I dont want to pass value of b as new argument.
colomon moritz: oh!
psch if you want to set $!a to the value of $.b do that in BUILD
sergot psch: of a
*
psch: I dont want to pass value of a as new argument.
moritz colomon: and the rpi has an arm11 CPU, which is 32bit
sergot r: class A { submethod BUILD(:$!a) {}; has $!a; has $.b; method new($b){ self.bless(:$b) } }; my $a = A.new("a"); 20:16
camelia ( no output )
sergot r: class A { submethod BUILD(:$!b) { $!a = $!b }; has $!a; has $.b; method new($b){ self.bless(:$b) }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a; 20:17
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«a␤»
sergot It works... 20:18
psch this will break on inhertiance though i think
oh, no, nevermind, you're not declaring $!a in new
should be fine
sergot r: sub some_sub() { return "!"; }; class A { submethod BUILD(:$!b) { $!a = $!b ~ some_sub(); }; has $!a; has $.b; method new($b){ self.bless(:$b) }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a; 20:19
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«a!␤»
sergot r: sub some_sub($c) { return $c; }; class A { submethod BUILD(:$!b) { $!a = $!b ~ some_sub(); }; has $!a; has $.b; method new($b){ self.bless(:$b) }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a; 20:20
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Calling 'some_sub' requires arguments␤ Expected: :(Any $c)␤at /tmp/tmpfile:1␤------> A { submethod BUILD(:$!b) { $!a = $!b ~ ⏏…»
sergot r: sub some_sub($c) { return $c; }; class A { submethod BUILD(:$!b) { $!a = $!b ~ some_sub($!b); }; has $!a; has $.b; method new($b){ self.bless(:$b) }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a; 20:20
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«aa␤»
sergot r: sub some_sub($c) { return $c; }; class A { submethod BUILD(:$!b) { isay $!b; w$!a = $!b ~ some_sub($!b); }; has $!a; has $.b; method new($b){ self.bless(:$b) }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a; 20:21
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Two terms in a row␤at /tmp/tmpfile:1␤------> A { submethod BUILD(:$!b) { isay $!b; w⏏$!a = $!b ~ some_sub($!b); }; has $!a; h…»
sergot r: sub some_sub($c) { return $c; }; class A { submethod BUILD(:$!b) { say $!b; $!a = $!b ~ some_sub($!b); }; has $!a; has $.b; method new($b){ self.bless(:$b) }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a;
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«a␤aa␤»
sergot It doesnt work on my machine.
r: sub some_sub($c) { return $c; }; class AAA { method new() { self.bless; } }; class A is AAA { submethod BUILD(:$!b) { say $!b; $!a = $!b ~ some_sub($!b); }; has $!a; has $.b; method new($b){ self.bless(:$b) }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a; 20:22
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«a␤aa␤»
sergot r: sub some_sub($c) { return $c; }; class AAA { has $.h; method new() { self.bless; } }; class A is AAA { submethod BUILD(:$!b) { say $!b; $!a = $!b ~ some_sub($!b); }; has $!a; has $.b; method new($b, $h){ self.bless(:$b, :$h) }; method print_a() { say $!a }; }; my $a = A.new("a", "h"); $a.print_a; 20:23
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«a␤aa␤»
timotimo raiph: having read a few bits of the TWEAST paper now, I think masak would agree that TWEAST is something we should be able to do with macros 20:25
sergot r: sub some_sub($c) { return $c; }; class AAA { has $.h; method new() { self.bless; } }; class A is AAA { submethod BUILD(:$!b) { say $!b; $!a = $!b ~ some_sub($!b); }; has $!a; has $.b; method new($b, *$h){ self.bless(:$b, :$h) }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a; 20:26
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«Not enough positional parameters passed; got 2 but expected 3␤ in method new at /tmp/tmpfile:1␤ in block at /tmp/tmpfile:1␤␤»
vendethiel sergot: why do you need to bless(:$b) ? 20:36
even before, what does `method new { self.bless }` does differently ? 20:37
moritz swallow named arguments
vendethiel so that you can just `A.new();` without passing arguments ? 20:38
moritz you could do that before
now you can say A.new(:thing) and :thing gets swallowed
so, probably not what's desired 20:39
masak p: class C { has $.x = die "forgot to pass argument to constructor" }; C.new 20:45
yoleaux 19:46Z <raiph> masak: "program transformation, optimization, instrumentation, etc [by] generating and rewriting ASTs ... can become tedious and hard to maintain ... . On the other hand, concrete syntax provides a natural and simpler representation of programs" (from www.lrde.epita.fr/dload/papers/dem....sac.pdf); I assume similar issues apply to
camelia rakudo-parrot 535d91: OUTPUT«forgot to pass argument to constructor␤ in method at /tmp/12PyNFGfnP:1␤ in block at gen/parrot/CORE.setting:894␤ in method BUILDALL at gen/parrot/CORE.setting:849␤ in method bless at gen/parrot/CORE.setting:838␤ in method new at gen/parr…»
TimToady masak: did you see my nextwith vs nextsame bug above? 20:46
masak sorry, not backlogged yet.
will have a look later, or tomorrow.
vendethiel p: class C { has $.x; }; my C $c .= new(:x<slt>); $c.x.say; 20:47
camelia rakudo-parrot 535d91: OUTPUT«slt␤»
vendethiel oh.
the autogenerated method accepts positional parameters by default
masak aye.
sergot Do I have to bless both private and public attributes? 20:48
colomon thought the autogenerated new accepted named parameters by default. 20:50
sergot vendethiel: I think that I have to bless to pass those as arguments of BUILD.
TimToady well, somebody has to bless, doesn't have to be you
TimToady my nextwith was calling the default new, which can bless, and bless will automatically run all the BUILDs for the actual type of the invocant, not the level of the new containing bless 20:51
otherwise default new couldn't work
sergot :D 20:52
sergot TimToady: is using {call,next}{same,with} a good practice? 20:54
TimToady it's a power tool :) 20:55
smls for $*IN.lines() -> $line { say $lines }
^^ should that work? 20:56
TimToady no
sergot You wrote using callsame is always a wrong way iirc.
vendethiel :p subset Quacking of Mu where *.^can('quack');
TimToady using it like that is useless, was my point, it just delegates back to the default new
vendethiel p: subset Quacking of Mu where *.^can('quack');
camelia ( no output )
TimToady std: for $*IN.lines() -> $line { say $lines } 20:57
camelia std 09dda5b: OUTPUT«===SORRY!===␤Variable $lines is not predeclared at /tmp/SFzj0N1Zp3 line 1:␤------> for $*IN.lines() -> $line { say ⏏$lines }␤Potential difficulties:␤ $line is declared but not used at /tmp/SFzj0N1Zp3 line 1:␤-----…»
sergot Ok, now I understand. :) 20:57
vendethiel p: subset Quacking of Mu where *.^can('quack'); sub quack(Quacking $p) { say 'a'; }; quack(5);
camelia rakudo-parrot 535d91: OUTPUT«Constraint type check failed for parameter '$p'␤ in sub quack at /tmp/QYw8g8pjEJ:1␤ in block at /tmp/QYw8g8pjEJ:1␤␤»
vendethiel p: subset Quacking of Mu where *.^can('quack'); sub quack(Quacking $p) { $p.quack(); }; class Duck { method quack { say 'quack!'; } }; quack(Duck.new);
camelia rakudo-parrot 535d91: OUTPUT«quack!␤»
vendethiel yay for structural typing
p: subset Quacking of Mu where *.^can('quack'); sub quack(Quacking $p) { $p.quack(); }; sub blackbox {quack(5); } 20:58
camelia ( no output )
vendethiel static checking can take care of that, probably
smls TimToady: right, I meant « for $*IN.lines -> $line { say $line } » 20:59
that just hangs for me (Rakudo Star 2014.01)
TimToady well it won't work without parens
which you had before 21:00
std: for $*IN.lines -> $line { say $line }
camelia std 09dda5b: OUTPUT«ok 00:01 127m␤»
smls doesn't seem to make a difference
neither works for me
TimToady oh wait, I'm wrong
it's just bare lines() that needs 'em
method is fine
r: for $*IN.lines -> $line { say $line }
camelia ( no output )
..rakudo-parrot 535d91: OUTPUT«There were three men came out of the West␤Their fortunes for to try␤And these three men made a solemn vow␤John Barleycorn must die␤␤They've ploughed, they've sewn, they've harrowed him in␤Threw clouds upon his head␤And these three men made …»
..rakudo-moar 535d91: OUTPUT«(signal SEGV)»
TimToady works here; is it just waiting for you to type something on stdin? 21:02
smls oh right, it works if I use a pipe to feed it input
put not if input comes interactively from the terminal
*but
yes, just waiting
TimToady works for me with latest star
you probably need a ^D before you see anything 21:03
smls ah ok
TimToady (shouldn't need it, if lines were sufficiently lazy)
sergot r: sub some_sub($c) { return $c; }; class AAA { method new() { self.bless; } }; class A is AAA { submethod BUILD(:$!b) { say $!b; $!a = $!b ~ some_sub($!b); }; has $!a; has $.b; method new($b){ self.bless() }; method print_a() { say $!a }; }; my $a = A.new("a"); $a.print_a;
TimToady so probably a buglet
camelia rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«(Any)␤use of uninitialized value of type Any in string context␤use of uninitialized value of type Any in string context␤␤»
..rakudo-parrot 535d91: OUTPUT«(Any)␤use of uninitialized value of type Any in string context in submethod BUILD at /tmp/tmpfile:1␤␤use of uninitialized value of type Any in string context in submethod BUILD at /tmp/tmpfile:1␤␤␤»
smls ok 21:04
sergot \o/ I've just found what I was doing wrong. :)
masak backlogs 21:06
smls Is there a way to read from STDIN incrementally (i.e. without waiting for EOF), that works right now? 21:13
TimToady $*IN.get maybe 21:14
masak TimToady: ok, now I'm backlogging. I see a lot of trying stuff out, but any bug is lost in the noise. 21:15
masak TimToady: do you think you could rebase the bug on the present? ;) 21:15
raiph: I will read the paper more carefully... but at first blush, "concrete syntax" sounds exactly like what we're doing with quasiquoting to me. let me know if I'm missing something. 21:16
TimToady r: class A { submethod BUILD(:$!v){ }; has $.v; method new(*%_) { say 'OH HAI!'; nextwith(|%_, :v<test>); }; }; class B is A { has $.newfiled }; my $b = B.new(:v('do you see me?'),:newfiled(43)); say 'v: ' ~ $b.v; say 'newfiled: ' ~ $b.newfiled; 21:17
camelia rakudo-jvm 535d91: OUTPUT«OH HAI!␤v: test␤newfiled: 43␤»
..rakudo-moar 535d91: OUTPUT«OH HAI!␤v: do you see me?␤newfiled: 43␤»
..rakudo-parrot 535d91: OUTPUT«OH HAI!␤duplicate named argument in call␤ in method new at /tmp/tmpfile:1␤ in block at /tmp/tmpfile:1␤␤»
TimToady that one
masak peers at it
ah. 21:18
yes.
something is definitely up with that one. :)
masak submits rakudobug
smls ok, this works: « while $*IN.get -> $line { say $line } » 21:19
TimToady as long as your line isn't '0' 21:20
timotimo hehe.
masak r: class A { submethod BUILD(:$!v){ }; has $.v; method new(*%_) { nextwith(|%_, :v<bar>); }; }; class B is A {}; my $b = B.new(:v('foo')); say $b.v 21:20
camelia rakudo-jvm 535d91: OUTPUT«bar␤»
..rakudo-parrot 535d91: OUTPUT«duplicate named argument in call␤ in method new at /tmp/tmpfile:1␤ in block at /tmp/tmpfile:1␤␤»
..rakudo-moar 535d91: OUTPUT«foo␤»
masak slightly minimaler. 21:20
timotimo hooray
diakopter wat :) 21:21
timotimo there's no DWIM to this WAT! :( 21:21
masak yeah, 'wat' about sums it up ;)
diakopter wattf
masak timotimo: there's no law says that every WAT has to have a DWIM :P
timotimo right 21:22
but it's not right!
masak bet it's just entropy at work, as usual.
the world ends up with an increasing number of WATs, over time.
TimToady and I don't buy that every WAT is equal and opposite; sometimes you can hide them where they do little harm
which is why I reduced you to "corresponding" :) 21:23
masak I... agree, but only in a subtle and reluctant way.
need to ponder that last bit.
diakopter I agree in a wat kind of way
smls TimToady: What would be the P6 translation of « while (defined(my $x = ...)) { ... } » ?
TimToady well, you can drop the parens :) 21:24
there's a subtle semantic difference in that that my will scope outside in P6
masak anyway, in the above WAT, I think Parrot is obviously wrong, so let's drop that one out of the contest. 21:25
between the other two, JVM makes the most sense to me.
TimToady r: while defined my $x = $*IN.get { }; say $x
masak anyone agree/disagree?
camelia rakudo-moar 535d91: OUTPUT«(signal SEGV)»
..rakudo-parrot 535d91, rakudo-jvm 535d91: OUTPUT«(Str)␤»
TimToady r: while defined my $x = $*IN.get { last if Bool.roll }; say $x
camelia rakudo-parrot 535d91: OUTPUT«And these three men made a solemn vow␤»
..rakudo-moar 535d91: OUTPUT«(signal SEGV)»
..rakudo-jvm 535d91: OUTPUT«(Str)␤»
TimToady ,,
diakopter m: $*IN.get
camelia rakudo-moar 535d91: OUTPUT«(signal SEGV)» 21:26
TimToady r: while defined my $x = $*IN.get { last if Bool.roll }; say $x
camelia rakudo-moar 535d91: OUTPUT«(signal SEGV)»
..rakudo-jvm 535d91: OUTPUT«(Str)␤»
..rakudo-parrot 535d91: OUTPUT«There were three men came out of the West␤»
diakopter r: say defined $*IN
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«True␤»
smls ok
TimToady r: while defined my $x = $*IN.get { last if Bool.roll }; say $x
camelia rakudo-parrot 535d91: OUTPUT«Their fortunes for to try␤»
..rakudo-moar 535d91: OUTPUT«(signal SEGV)»
..rakudo-jvm 535d91: OUTPUT«(Str)␤»
diakopter r: say +$*IN
camelia rakudo-jvm 535d91: OUTPUT«Cannot call 'Numeric'; none of these signatures match:␤:(Mu:U \v: *%_)␤ in any at gen/jvm/BOOTSTRAP.nqp:1212␤ in any at gen/jvm/BOOTSTRAP.nqp:1202␤ in method Numeric at gen/jvm/CORE.setting:1008␤ in sub prefix:<+> at gen/jvm/CORE.setting:384…»
..rakudo-moar 535d91: OUTPUT«Cannot call 'Numeric'; none of these signatures match:␤:(Mu:U \v: *%_)␤ in method Numeric at src/gen/m-CORE.setting:1008␤ in sub prefix:<+> at src/gen/m-CORE.setting:3849␤ in sub prefix:<+> at src/gen/m-CORE.setting:3848␤ in block at /tmp/tm…»
..rakudo-parrot 535d91: OUTPUT«Cannot call 'Numeric'; none of these signatures match:␤:(Mu:U \v: *%_)␤ in any at gen/parrot/BOOTSTRAP.nqp:1219␤ in any at gen/parrot/BOOTSTRAP.nqp:1210␤ in method Numeric at gen/parrot/CORE.setting:1011␤ in sub prefix:<+> at gen/parrot/C…»
TimToady jvm seems to be consistently wrong
TimToady moar seems to be differently consistenly wrong 21:27
masak ;)
turns out having different backends is almost as informative as having different implementations :)
diakopter or misinformative 21:28
.oO( it's hard to pick up all your marbles and run home if you've lost them all... )
TimToady it also helps greatly to have consolidated the almost identical ones, but for the filename 21:33
j: while defined my $x = $*IN.get { say $x; last if Bool.roll }; say $x 21:34
camelia rakudo-jvm 535d91: OUTPUT«(Str)␤»
TimToady ooh, never enters the loop
masak so (Str) is the undef from the first .get call 21:35
TimToady j: while my $x = $*IN.get { say $x; last if Bool.roll }; say $x 21:36
camelia rakudo-jvm 535d91: OUTPUT«(Str)␤»
TimToady not the defined
it's like the = is returning the value before rather than the value after, like a postincr 21:38
so definitely a bug 21:39
TimToady r: $_ = 'before'; say $_ = 'after'; 21:41
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«after␤»
TimToady r: say (my $x = 'before) = 'after'; 21:42
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Unable to parse expression in single quotes; couldn't find final "'" ␤at /tmp/tmpfile:1␤------> say (my $x = 'before) = 'after';⏏[…»
TimToady r: say (my $x = 'before') = 'after'; 21:43
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«after␤»
TimToady I guess it's just the pseudo-assignment that is misbehaving
TimToady r: say my $x = 'after'; 21:44
camelia rakudo-parrot 535d91, rakudo-jvm 535d91, rakudo-moar 535d91: OUTPUT«after␤»
TimToady and not there, huh
TimToady r: say my $x = $*IN.get; 21:46
camelia rakudo-moar 535d91: OUTPUT«(signal SEGV)»
..rakudo-jvm 535d91: OUTPUT«(Str)␤»
..rakudo-parrot 535d91: OUTPUT«There were three men came out of the West␤»
TimToady odd 21:47
masak submits rakudobug for $*IN.get 21:48
r: say $*IN.get
camelia rakudo-moar 535d91: OUTPUT«(signal SEGV)»
..rakudo-jvm 535d91: OUTPUT«(Str)␤»
..rakudo-parrot 535d91: OUTPUT«There were three men came out of the West␤»
TimToady oh hey
masak++
masak entia non sunt blablabla ;) 21:49
diakopter I did that.. but m: instead of r: :D 21:50
TimToady masak: did you hear something? ;)
diakopter: but nobody expects moar to work yet... :P 21:51
perigrin moar work to be done
TimToady done work needs to be moar :) 21:52
diakopter moar moar moar to moar moar
perigrin One does not mearly do work to moar (dor).
diakopter moor mourns moar mowers 21:53
perigrin "At length they discover'd the bonnie moar-vm" 21:54
I rede you, beware at the debugging, youg men 21:55
TimToady mmm oar oar oar!
perigrin is a little late for burns night. 21:55
diakopter TimToady: I think you burst a seal 21:56
it was probably a mo ring 21:57
TimToady you've lost yer moaring, arr! 21:58
diakopter now the boat will ... roam...
lue the boat is no longer moared. 22:00
masak the moat is no longer boared. 22:01
masak 'night, #perl6 22:30
TimToady o/ 22:31
dalek rl6-roast-data: bc515e3 | coke++ | / (6 files):
today (automated commit)
22:50
jnthn evening, #perl6 23:08
[Coke] jnthn++o/ 23:09
jnthn Belgium. They do beer right. :) 23:11
.oO( If it kvaks like a duck... )
23:12
timotimo hey jnthn! 23:13
how was fosdem? :)
jnthn Saw some folks were after my FOSDEM slides. Here they are: jnthn.net/papers/2014-fosdem-perl6-today.pdf
timotimo is there going to be a perl6 development sprint nearby?
yay!
jnthn timotimo: Well, lizmat++ and I will hack tomorrow. After that I gotta go to Stockholm and teach for a couple of days. Then I'll be back and able to dig into Perl 6 hacking again :) 23:14
timotimo okay
i've gotten a reasonable amount of $dayjob work done today, although i spent almost the entire day procrastinating
javascript can be pretty ... weird
jnthn Some of my most productive days are ones where I procrastinate a bunch, then end up solving the tiny interesting problem inside of a big one I started with. :) 23:16
woolfy jnthn++ for his slides. I am too tired after 3 days of Fosdem to look at all of them, so I just went through them very fast. excellent stuff. Thanks for doing this. Highest praise from many attendees! 23:17
jnthn Yes, it was nice to talk to some folks today who came to say hi and ask a few follow-up questions after the talk :) 23:19
timotimo jnthn: the observation action method would have been a pretty good candidate for coercing to Rat, IMO 23:22
jnthn timotimo: No, Rat is when you know the value exactly. These are measurements, with error. 23:23
There's no point in paying the price of rationals over floating point when you're dealing with data that already has an error. 23:24
timotimo oh, that does indeed make sense 23:25
dalek kudo/nom: ada4cdd | jonathan++ | src/perl6-debug.nqp:
Fix REPL/debugger interaction.

When you wrote one line in the debugger REPL, than a second that used something in the first, things got messed up. This fixes it.
23:28
kudo/nom: 4a74e76 | jonathan++ | src/vm/jvm/core/Promise.pm:
Promise.keep should not scalarize its result.
23:29
[Coke] jnthn: i cannot remember the last time i beered. 23:30
timotimo jnthn: i found the quality of the slides to be as impressively good as pretty much all your slides i've seen so far :) 23:31
jnthn [Coke]: oh noes!! 23:37
[Coke]: Belgium is a pretty great place to beer. 23:38
We went to a restaurant tonight and there was no beer on the menu and I'm thinking "wtf"...
So I ask, and they bring...a beer menu!!
skids lol.
timotimo :D 23:39
jnthn Best thing: Rochefort 10 costs about a third as much at a bar here as it does in Sweden. :)
timotimo .o( isn't that actually a kind of cheese? )
jnthn timotimo: www.ratebeer.com/beer/rochefort-tra...s-10/2360/ 23:42
timotimo fair enough :) 23:43