»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend!
Set by sorear on 4 February 2011.
sorear good * #perl6 05:43
JimmyZ_ nom: class A { method pick() { say 'pick'; }; method hi() { self.?pick; }; }; A.new.hi; 06:16
p6eval nom 081cc0: OUTPUT«pick␤»
JimmyZ_ nom: class A { method !pick() { say 'pick'; }; method hi() { self!?pick; }; }; A.new.hi;
p6eval nom 081cc0: OUTPUT«===SORRY!===␤Unable to parse blockoid, couldn't find final '}' at line 2␤» 06:17
JimmyZ_ how can I use '?' in private method call? 06:21
I need it because Perl 6 supprot trust class 06:23
*supports
std: class A { method !pick() { say 'pick'; }; method hi() { self!?pick; }; }; A.new.hi; 06:26
p6eval std be1f10e: OUTPUT«===SORRY!===␤Negation metaoperator not followed by valid infix at /tmp/RuetET4PRT line 1:␤------> k() { say 'pick'; }; method hi() { self!⏏?pick; }; }; A.new.hi;␤ expecting any of:␤ bracketed infix␤ infix␤ infix or
..meta-infix␤P…
dalek ecza: a117854 | sorear++ | / (7 files):
KILL _PASSCAP WITH FIRE
06:28
JimmyZ nom: class A { trust GLOBAL; has $!foo; }; A.new!A::foo = 'hi'; 07:15
p6eval nom 081cc0: OUTPUT«===SORRY!===␤Cannot call private method 'foo' on package A because it does not trust GLOBAL at line 1, near " = 'hi';"␤»
tadzik hehe 07:18
sorear -> sleep 07:28
jnthn nom: class A { trusts GLOBAL; has $!foo; }; A.new!A::foo = 'hi'; 07:34
p6eval nom 081cc0: OUTPUT«Private method 'foo' not found on type A␤ in method dispatch:<!> at src/gen/CORE.setting:769␤ in block <anon> at /tmp/eZljxUG0nO:1␤ in <anon> at /tmp/eZljxUG0nO:1␤»
jnthn Spelling. It helps. :)
jnthn !? would not help either, detection of missing or not allowed private methods is compile time. 07:35
JimmyZ Private method 'foo' not found on type A? 07:40
moritz it doesn't have any private method foo 07:41
JimmyZ looks like trusts.t is NYI 07:43
jnthn JimmyZ: Where exactly did you declare a private method? 07:50
JimmyZ I see it in trusts.t 07:51
jnthn Just because a test file thinks it should work doesn't mean it should.
I'm kinda dubious about has $!x generating a private method. 07:52
JimmyZ specs doesn't say private $!x gen private method, it says $x gen public method, iirc 07:53
jnthn $.x gens a public one. 07:54
has $x is just sugar for has $!x
plus you get to write $x in your code too
Nobody seems to really use it much though...seems most folks like to explicitly mark attribute access\ 07:55
jnthn (And it ain't for lack of implementation. iirc, alpha, ng and nom have all supported this) 07:55
JimmyZ nom: class A { trust GLOBAL; has $foo; }; A.new!A::foo = 'hi'; 07:57
p6eval nom 081cc0: OUTPUT«===SORRY!===␤Cannot call private method 'foo' on package A because it does not trust GLOBAL at line 1, near " = 'hi';"␤»
JimmyZ doesn't like $x too. 07:58
jnthn JimmyZ: It's tursts, not trust
JimmyZ bad chatzilla :(
jnthn hehe :)
helpful fail :) 07:59
ooh, my students showed up. Guess I shoudl teach them stuff. :) 08:00
JimmyZ wonders what jnthn teaches, perl 6? 08:01
JimmyZ more likes $x is a sugar for $.x 08:13
tadzik it is? 08:15
everyday I learn
moritz I don't think so 08:27
nom: class A { has $x }; say A.^attributes
p6eval nom 081cc0: OUTPUT«$!x␤»
moritz nom: class A { has $x }; say A.^methods(:local)
p6eval nom 081cc0: OUTPUT«␤»
moritz no accessor is generated
so 'has $x' is more like 'has $!x' 08:28
vlixes xk 08:36
JimmyZ hopes has $x is more like has $.x 08:37
:)
moritz wow, the trusts tests are weird 08:42
try { something }; is $!.defined ?? 1 !! 0, 0, '..';
it also tests only attributes, not methods 08:43
JimmyZ :) 08:44
moritz erm, the whole section on trusts is weird 08:45
it talkes about "private attribute accessors", but I don't think we have such a thing
we access private attributes directly, not via accessors 08:46
furthermore it only gives the syntax for accessing private methods, not attributes 08:47
dalek ast: 0624a37 | moritz++ | S12- (2 files):
move trusts tests to S12-attributes/, add a note about possible issues
08:51
dalek ast: 28f3971 | moritz++ | S12-methods/trusts.t:
tests for method trusts
09:06
kudo/nom: d5729f9 | moritz++ | t/spectest.data:
run new S12-methods/trusts.t
09:09
jnthn moritz++ 09:13
moritz stackoverflow.com/questions/100003/...49#6581949 # meta classes seem to be a popular topic these days :-) 09:17
JimmyZ wonders why not $class!get-x-priv() , $truster!Truster::get-x-priv(); is a bit ugly
jnthn JimmyZ: I'm GLAD it's ugly because you should not be doing it apart from in exceptional cases. 09:19
Also private methods are non-virtual. 09:20
moritz JimmyZ: because private methods are not virtual
moritz too slow
jnthn Which is the real reason you must fully qualify it. 09:20
Note that you can do self!foo() 09:22
So the way private methods are meant to be used is huffmanized :) 09:23
dalek : 806da6c | moritz++ | misc/perl6advent-2011/schedule:
[advent] I did day 15
09:26
moritz jnthn: I have a curious OO problem in perl 6, maybe you know a nice solution... 10:22
I have a class X::Base, which has a multi method gist
and then I'd like to have a role X::Comp, which also has a multi method gist
(both need to be multi methods that allow only defined invocants; otherwise type object stringification breaks) 10:23
moritz so, if I have a class that inherits from X::Base and composes X::Comp, I get an ambiguous dispatch to method gist 10:23
can I arrange it in some way so that the gist from the role takes precedence? 10:24
there will be lots of class with those features, so I don't want to disambiguate in every class individually 10:25
currently I just make X::Comp (compile time errors) a subclass of X::Base, but having it as a role would be much nicer (because there are errors that can be both compile time and run time, and I'd rather not have two separate classes for that) 10:26
moritz nqp: my &a = sub () { say(5) }; a 11:02
p6eval nqp: OUTPUT«Can't exec "./nqp": No such file or directory at lib/EvalbotExecuter.pm line 192.␤exec (./nqp /tmp/6cLZrEEu2F) failed: No such file or directory␤»
moritz parallel dyncall build seems to fail on evalbot 11:07
dalek albot: 8dd8ee7 | moritz++ | build-scripts/rebuild-nqp.sh:
rebuild nqp serially
11:09
moritz nqp: my &a = sub () { say(5) }; a 11:14
p6eval nqp: OUTPUT«Assignment ("=") not supported in NQP, use ":=" instead at line 1, near " sub () { "␤current instr.: 'nqp;HLL;Grammar;panic' pc 23437 (src/stage2/gen/NQPHLL.pir:6735) (src/stage2/gen/NQPHLL.pm:329)␤»
moritz nqp: my &a := sub () { say(5) }; a
p6eval nqp: ( no output )
moritz nqp: my &a := sub () { say(5) }; &a()
p6eval nqp: OUTPUT«5␤»
moritz nqp: my a := sub () { say(5) }; a()
p6eval nqp: OUTPUT«Confused at line 1, near "my a := su"␤current instr.: 'nqp;HLL;Grammar;panic' pc 23437 (src/stage2/gen/NQPHLL.pir:6735) (src/stage2/gen/NQPHLL.pm:329)␤»
jnthn moritz: well, the hack to your multi issue is that the one from the role says "is default"... :) 11:20
moritz jnthn: I thought of that, and considered it a kind of "last resort" 11:21
but maybe that's what I should do 11:23
moritz urks, 'is default' doesn't work in the setting :/ 11:26
ah, because infix:<does> is defined in operators.pm, which comes rather later 11:27
*late
jnthn heh :) 11:28
moritz tries to move it to the front 11:29
jnthn Yeah, I'd really hoped we'd never need is default in the setting...
There must be some better way, I just can't think of it right off
moritz can I deliberately widen then invocant type constraint in X::Base.gist? 11:30
something like multi method gist(Any:D:) { ... }
though that sounds like a cheat too
nom: class A { multi method a(Any:D:) { 'A' } }; role B { multi method a(B:D:) { 'b' } }; class C is A does B { }; say C.a 11:31
p6eval nom d5729f: OUTPUT«No applicable candidates found to dispatch to for 'a'. Available candidates are:␤:(B, Mu %_)␤:(Any, Mu %_)␤␤ in method a at src/gen/CORE.setting:289␤ in block <anon> at /tmp/D7oTaL8kMf:1␤ in <anon> at /tmp/D7oTaL8kMf:1␤»
moritz nom: class A { multi method a(Any:D:) { 'A' } }; role B { multi method a(B:D:) { 'b' } }; class C is A does B { }; say C.new.a
p6eval nom d5729f: OUTPUT«b␤»
moritz is that allowed? 11:32
or can I tighten the invocant constraint in the role to $?CLASS:D: or so?
jnthn moritz: uh, the role it should automatically get tightened at comkpositoin time... 11:34
That is, ::?CLASS is the default invocant type
oh, you want to restrict to :D though?
In that case then yes, you can ::?CLASS:D: iirc
moritz nom: class A { multi method a(A:D:) { 'A' } }; role B { multi method a(::?CLASS:D:) { 'b' } }; class C is A does B { }; say C.new.a 11:36
p6eval nom d5729f: OUTPUT«b␤»
moritz \o/
jnthn: all that fuss wouldn't be necessary if rakudo simply honored the :D default on method invocants :-)
jnthn moritz: Is that actually spec now? 11:53
grondilu perl6: constant abc = "fo"; say "foo" ~~ / <[abc]> / 12:23
p6eval pugs b927740: OUTPUT«*** ␤ Unexpected "="␤ expecting ":" or "("␤ at /tmp/snH5zR7OP8 line 1, column 14␤»
..niecza v12-49-ga117854: OUTPUT«Match()␤»
..rakudo d5729f: OUTPUT«#<failed match>␤»
grondilu perl6: constant abc = "fo"; say "foo" ~~ / <[{abc}]> /
p6eval niecza v12-49-ga117854: OUTPUT«Match()␤»
..rakudo d5729f: OUTPUT«#<failed match>␤»
..pugs b927740: OUTPUT«*** ␤ Unexpected "="␤ expecting ":" or "("␤ at /tmp/p891exYi5p line 1, column 14␤»
moritz std: 1 ?? $_ = 3 !! $_ = 5 12:45
p6eval std be1f10e: OUTPUT«===SORRY!===␤Precedence of = is too loose to use between ?? and !!; please use parens around inner expression at /tmp/pRTniwEOGL line 1:␤------> 1 ?? $_ =⏏ 3 !! $_ = 5␤Parse failed␤FAILED 00:01 121m␤»
grondilu what's 'std'? 12:47
moritz the standard grammar
niecza: 1 ?? $_ = 3 !! $_ = 5 12:48
p6eval niecza v12-49-ga117854: ( no output )
moritz sorear: see above, should parse-fail
mathw moritz++ good article on exception handling :) 12:59
moritz thanks mathw
moritz now we just need an advent post for today 13:01
colomon has not yet started writing his for tomorrow, alas.... 13:03
mathw The advent calendar is really cool this year
it feels like 'we'll all be using this in production soon' 13:04
moritz mathw: anything in particular you'd want to read about? 13:05
moritz has an idea, but it would result in a rather long post 13:07
use cases for references in p5, and what Perl 6 offers instead
mathw that might be interesting 13:14
Perl 6's approach to reference-like things is quite different
moritz and the interesting thing is it also differs depending on the use case 13:15
moritz writes the post
colomon moritz++
flussence ooc, does Perl 6 pass anything by value? 13:16
moritz everything except native types
but since many primitives are immutable, you don't see that :-)
nom: my $x = 4; my $y = 5; my $c = \($x, $y); $c[0] = 8; say $c[0] 13:18
p6eval nom d5729f: OUTPUT«Cannot assign to a readonly variable or a value␤ in block <anon> at /tmp/bIyeE3iY4U:1␤ in <anon> at /tmp/bIyeE3iY4U:1␤»
moritz shouldn't that work? 13:19
colomon b: my $x = 4; my $y = 5; my $c = \($x, $y); $c[0] = 8; say $c[0] 13:21
p6eval b 1b7dd1: OUTPUT«8␤»
colomon niecza: my $x = 4; my $y = 5; my $c = \($x, $y); $c[0] = 8; say $c[0]
p6eval niecza v12-49-ga117854: OUTPUT«8␤»
moritz nom: my @a = 1, 2; my @b = 3, 4;, @a[3] = @b; say @a.elems; .say for @a[3]; 13:33
p6eval nom d5729f: OUTPUT«===SORRY!===␤Confused at line 1, near ", @a[3] = "␤»
moritz nom: my @a = 1, 2; my @b = 3, 4; @a[3] = @b; say @a.elems; .say for @a[3];
p6eval nom d5729f: OUTPUT«4␤3 4␤»
jnthn moritz: Captures are immutable, but I'm not sure how deep that goes
moritz jnthn: I thought it preserved the variables in there as rw 13:34
after all, captures are supposed to be argument lists, and 'is rw' or \-parameters wouldn't work with deeply-ro captures at all
jnthn moritz: ah....yeah, I see. .list on Capture appears to return a List which is immutable 13:35
I think
That's where it loses the mutability
moritz and that's what .[] uses?
jnthn I guess it's hitting the Any case of .[], and thus doing .list.[] or so
moritz ah, then Capture might need its own at_pos or .[] 13:36
jnthn yeah 13:41
moritz moritz.faui2k3.org/tmp/references.pod # advent post preview 13:44
I haven't even proof-read it a single time, so if it makes sense to you, be double impressed :-) 13:45
PerlJam moritz++ 13:47
jnthn push @a, $@b;
nom: my @a; my @b = 1,2,3; push @a, $@b; say @a.elems 13:48
p6eval nom d5729f: OUTPUT«===SORRY!===␤Invalid hard reference syntax at line 1, near "@b; say @a"␤»
PerlJam moritz: I'd take out the text about persuading Larry
jnthn std: my @a; my @b = 1,2,3; push @a, $@b; say @a.elems
p6eval std be1f10e: OUTPUT«===SORRY!===␤Invalid hard reference syntax at /tmp/7YrV1lyCI5 line 1:␤------> my @a; my @b = 1,2,3; push @a, $⏏@b; say @a.elems␤ expecting any of:␤ desigilname␤ twigil␤Parse failed␤FAILED 00:01 123m␤»
jnthn hm, why's that not work :)
PerlJam moritz: s/automatically buts/automatically puts/ 13:49
jnthn # automatically buts @b in item context
flussence bit of an awkward NativeCall question: in the v1/pre-nom version, I could write fake typedef stuff using, say, "class timeval is OpaquePointer" for time.h and it'd work. The new one won't let me do that because it's enforcing types more strictly, or something. Can I have that back? :)
jnthn pu...oh, PerlJam reads faster :P
moritz PerlJam: I feel I should mention why @$a works, but $@a does not; and I found no good reason
PerlJam: so I feel I should say *something*
on that topic
jnthn flussence: You already have it
PerlJam moritz: okay
moritz fixes the typo
jnthn flussence: class timeval is repr('CPointer') { } 13:50
flussence jnthn++ :D
moritz PerlJam: why do you think I shouldn't write it? do you think it puts up too much pressure?
PerlJam moritz: nah, it just doesn't quite fit in my world view. You're talking about things that *are* and then you talk about something that you'd like to be 13:51
flussence I wonder if :D/:U work on those... it might help me figure out why this library's complaining about me giving it nulls. 13:52
moritz try it :-)
PerlJam moritz: if I were writing the article, that spot is where I'd put a sidebar or something ... "Why doesn't $@a work?"
moritz PerlJam: I don't think wordpress supports side bars, at least not easily 13:53
PerlJam no worries. It's your article. It's good. My commentary was just a minor nit :)
moritz but yes, I can take it a bit out of the normal narrative
moritz anyway, thanks to jnthn++ and PerlJam++ for the feedback 13:59
moritz perl6advent.wordpress.com/2011/12/1...nces-gone/ 14:01
dalek href="https://perl6.org:">perl6.org: 9e90ebf | duff++ | source/documentation/index.html:
add 2011 advent calendar link
14:12
kboga hi moritz, found your blogpost very informative (having done some p5) 14:15
moritz \o/ 14:16
kboga maybe: s/will also to persuade/will also try to persuade/ & s/the same thing is the other/the same thing as the other/ ? 14:21
moritz yes 14:22
fixed, thanks. kboga++
kboga np, if it helps the community somehow :) 14:23
moritz hopes it does 14:25
yesterday we around 5k visitors :-)
kboga wow, thats amazing 14:26
moritz (mostly from reddit and hackernews) 14:27
kboga oh yea yesterday's blogpost s/can chose/can choose/ ? 14:28
moritz fixed too, thanks again 14:29
donri what are the benefits of this whole scalar vs list/etc context debacle? i assume there are gains, but as an outsider from perl it looks like just complicating matters at a glance 14:36
moritz I sometimes wonder the same thing
donri i recall realizing some benefit that i've now forgotten :P 14:37
moritz there are a few nice benefits, like being able to write for 0..9, 'a'..'z' { ... } and have it do what I want
donri but that's easily done even in python by simply joining the lists
moritz basically it makes it easer to concatenate list, but makes it harder to nest them 14:38
it's a tradeoff
donri but maybe this means you can treat scalar values as single-element lists?
donri does that work for arbitrary scalars 14:38
moritz yes
nom: say 1.join('foo')
p6eval nom d5729f: OUTPUT«1␤»
moritz nom: say 1[0]
p6eval nom d5729f: OUTPUT«1␤»
PerlJam that's more lispy 14:39
donri i guess that can be a benefit then (but might also mask bugs)
JimmyZ Is 'my $ = @a' same as '$(@a)' ? 14:40
donri i often find myself in python having to deal with e.g. None vs x vs [x..]
moritz JimmyZ: yes
JimmyZ moritz: thanks 14:41
PerlJam I think context sensitivity is part of Perl's DNA and that differentiating between singulars and plurals is the most basic genetic component
moritz nom: (my $ = @*INC) = 5;
p6eval nom d5729f: ( no output )
moritz nom: $(@*INC) = 5;
p6eval nom d5729f: OUTPUT«Cannot assign to a readonly variable or a value␤ in block <anon> at /tmp/z9EmLKnoYQ:1␤ in <anon> at /tmp/z9EmLKnoYQ:1␤»
moritz well, not exactly the same thing :-)
but from a perspective of item vs. list it's the same thing
JimmyZ nom: say (my $ = @*INC) = 5;
p6eval nom d5729f: OUTPUT«5␤»
JimmyZ nom: say (item @*INC) = 5; 14:42
p6eval nom d5729f: OUTPUT«Cannot assign to a readonly variable or a value␤ in block <anon> at /tmp/j6k2fzcGok:1␤ in <anon> at /tmp/j6k2fzcGok:1␤»
moritz we could also make them behave the same way, not sure if that's desirable
donri conversely, having done haskell for a while now, it seems bad form to try to accept different types for the same argument to a function. but i guess it makes sense in dynamic languages, and in that regard perl being "more dynamic" than python 14:43
JimmyZ well, looks like Perl 6 supports @$scalar but not $@array
moritz JimmyZ: that's what I wrote in my post, yes
JimmyZ Perl6 should support $@array, because it supports $@array 14:44
:)
moritz I'm all for it
tadzik circular logic is good, because it's circular :)
donri logic is good because it's logical 14:45
moritz I just think that @Larry had a reason to disallow it, and like to hear if it's still valid
JimmyZ and $% or %$ ? 14:47
moritz same thing 14:48
flussence I think I'm doing something wrong/stupid... I thought this would DWIM: "class R { has $r; method new($r) { self.bless(*, :$r); } }" but it only works if I add "submethod BUILD(:$r) { $!r = $r }" too. I'm trying to get a new() that takes a single positional param instead of having to write out the name. 14:49
moritz hm 14:50
PerlJam flussence: has $r; and not has $.r ? 14:51
or has $!r 14:52
flussence it's actually a $! var in the code, mis-transcribed it.
PerlJam just checking in case it's relevant :)
flussence (if anyone can suggest something that can make writing it shorter than R.new(1) that'd be even better :) 14:54
flussence oh well, a few extra lines doesn't matter. more important is my code works now :D 15:07
moritz flussence: at some point in the initialization chain, .new() needs to stop passing the named arguments to the initialization routine 15:15
flussence: and it seems that rakudo does that in or after bless, not before
not sure if that's how it is supposed to be, or not 15:16
oh, and the shortest option is of course augment class Mu { method r() { R.new(self) } } and then on any object just .r
but well, it is *only* short :-) 15:17
jnthn huh 15:22
sub r($x) { R.new($x)
jnthn then just r 1 15:22
or a postfix ;)
flussence hm, I just realised something - right now I'm using one class for is repr('CPointer') and a wrapper around it that just adds a few methods. If I knew how to get at the native value directly I could probably combine them into a single class (and wouldn't need the .new stuff at all) 15:25
jnthn An object with CPointer repr can have methods, though not attributes. 15:26
(having methdos is totally orthogonal to representation)
flussence so I'd just replace the wrapper's $!value with self... I think I'll just do that instead :) 15:28
jnthn :)
moritz it just shows that the shortest code is the one you don't have to write :-) 15:30
sorear good * #perl6 15:47
jnthn 5 hour decommute & 15:48
colomon \o 16:01
flussence
.oO( the only way this could get any better is if the --> notation for return values worked on native subs... )
16:02
TimToady for the record, I'm fine with $@array 16:09
TimToady since bare $@ will blow up anyway as an rvalue 16:10
fglock this may be off-topic here, 16:11
perlcabal.org/~fglock/perlito5.html
a mini-perl5 in the browser, based on Perlito
fglock Perl6 version here: perlcabal.org/~fglock/perlito.html 16:13
PerlJam fglock: that AST is a perlito thing? 16:14
fglock PerlJam: yes
it helps me debug
PerlJam still wonders what happened to Perl-5-with-AST
I was hopeful that project could be a nice bridge between perl 5 and perl 6 16:15
JimmyZ TimToady: and $% ? 16:20
TimToady sure, it's just item
JimmyZ nice 16:21
JimmyZ wonders how about 'has $x' is same as 'has $.x' , not 'has $!x', hehe :) 16:23
PerlJam JimmyZ: privacy is a good default. 16:24
moritz I'd rather remove 'has $x' entirely 16:25
JimmyZ PerlJam: that's for apple company
moritz I don't see any real benefit over 'has $.x' and 'has $!x'
PerlJam moritz: That'd work for me. 16:26
JimmyZ +1 to moritz too
TimToady it's really for people who think they're allergic to twigils 16:27
TimToady thinks about "has x"
JimmyZ thinks public is a good default, likes open source
PerlJam I think more people will be confused about the correspondence between has $x; method foo { ... $!x ... }
moritz TimToady: as long as you don't plan to allow it to interpolate into double-quoted strings... 16:28
TimToady {x} 16:29
moritz has \n; say "a\n" # whoops?
JimmyZ has \x ? like sub foo(\$x) { ... } to sub foo(\x) { ... } ?
TimToady \ is not a sigil
JimmyZ just like &x
TimToady JimmyZ: \$x is going away in favor of \x 16:30
PerlJam JimmyZ: more like Perl 5's typeglob
JimmyZ TimToady: yes, I heard that
TimToady and pretty quickly someone will write a pragma that say if x is unrecognized in a signature, assume a \ 16:32
TimToady *says 16:32
moritz std: sub f { @%_ } 16:33
p6eval std be1f10e: OUTPUT«===SORRY!===␤Invalid hard reference syntax at /tmp/pKLm_6uacq line 1:␤------> sub f { @⏏%_ }␤ expecting any of:␤ desigilname␤ twigil␤Parse failed␤FAILED 00:01 119m␤»
PerlJam sigilless Perl still gives me the creeps. 16:34
moritz I'll just spec $@foo and let others figure out the implementation :-) 16:35
dalek ecs: 32c6d03 | moritz++ | S02-bits.pod:
[S02] $%h and $@a item context forms
16:43
JimmyZ nom: my %a = 1 => 2, 3 => 4; my $b = %a; my @c = @$b; say @c.perl; 16:52
p6eval nom d5729f: OUTPUT«Array.new("1" => 2, "3" => 4)␤»
JimmyZ nom: my %a = 1 => 2, 3 => 4; my @c = @%a; say @c.perl; 16:53
p6eval nom d5729f: OUTPUT«===SORRY!===␤Invalid hard reference syntax at line 1, near "%a; say @c"␤»
JimmyZ wonders how about @%
JimmyZ nom: my %a = 1 => 2, 3 => 4; my @c = @(%a); say @c.perl; 16:53
p6eval nom d5729f: OUTPUT«Array.new("1" => 2, "3" => 4)␤»
JimmyZ nom: my %a = 1 => 2, 3 => 4; my @c = @(%a); my %d = %(@c); say %d.perl; 16:56
p6eval nom d5729f: OUTPUT«("1" => 2, "3" => 4).hash␤» 16:56
JimmyZ and %@a 16:57
moritz JimmyZ: I don't think they are very useful 16:57
I find %h.pairs much more readable than @%a
JimmyZ moritz: just for unify 16:59
why $(@a) can write as $@a, but %(@a) can't write as %@a :) 17:01
PerlJam were it my decision, you wouldn't be able to write $@a or %@a or anything without the parens 17:03
JimmyZ IMO, if $@ and @$ is allowed, %@ and @% shouldn't be disallowed at comiple time 17:05
moritz PerlJam: I've used @a.item and $(@a) in my code, and wished it was shorter
ashleydev moritz: you're interchainging tmp and temp as the name for the same var in the advent post. 17:08
JimmyZ nom: my %a = 1 => 2, 3 => 4; my @c = @(%a); say @c.perl;
p6eval nom d5729f: OUTPUT«Array.new("1" => 2, "3" => 4)␤»
ashleydev i.e typo 17:09
JimmyZ does @c has key "1" and "3" ?
*have
nom: say @.perl 17:11
p6eval nom d5729f: OUTPUT«Null PMC access in find_method('perl')␤ in block <anon> at /tmp/nllL48IQVT:1␤ in <anon> at /tmp/nllL48IQVT:1␤»
moritz ashleydev: thanks, fixing...
JimmyZ nom: say $.perl 17:12
p6eval nom d5729f: OUTPUT«Null PMC access in find_method('perl')␤ in block <anon> at /tmp/KwW4TXpIR3:1␤ in <anon> at /tmp/KwW4TXpIR3:1␤»
JimmyZ nom: say !.perl 17:13
p6eval nom d5729f: OUTPUT«Bool::False␤»
GlitchMr perl6: print 2 ~~ '2'
p6eval rakudo d5729f, niecza v12-49-ga117854: OUTPUT«True»
..pugs b927740: OUTPUT«1»
GlitchMr perl6: print [2] ~~ ['2']
p6eval rakudo d5729f, niecza v12-49-ga117854: OUTPUT«False»
..pugs b927740: OUTPUT«1»
GlitchMr That makes sense :)
Not like I care... 17:14
JimmyZ nom: say |.perl 17:15
p6eval nom d5729f: OUTPUT«Method 'FLATTENABLE_LIST' not found for invocant of class 'Str'␤ in block <anon> at /tmp/yDnkVnGCO5:1␤ in <anon> at /tmp/yDnkVnGCO5:1␤»
GlitchMr perl6: print (e, a => 'b', c => 'd', a => 'c', pi, a => 'c').perl 17:16
p6eval rakudo d5729f: OUTPUT«(2.71828183e0, "a" => "b", "c" => "d", "a" => "c", 3.14159265e0, "a" => "c")»
..pugs b927740: OUTPUT«*** No such subroutine: "&e"␤ at /tmp/qf2i4lVV8j line 1, column 7 - line 2, column 1␤»
..niecza v12-49-ga117854: OUTPUT«(2.71828182845905, "a" => "b", "c" => "d", "a" => "c", 3.14159265358979, "a" => "c")»
GlitchMr It reminds me PHP for some reason...
JimmyZ nom: say !.WHAT 17:23
p6eval nom d5729f: OUTPUT«Bool::True␤»
GlitchMr perl6: print q <<20>> 17:24
JimmyZ wonders how it outputs true
p6eval pugs b927740, rakudo d5729f, niecza v12-49-ga117854: OUTPUT«20»
sorear JimmyZ: .WHAT means $_.WHAT, which returns Any because $_ defaults to Any; Any is a false value so !Any is true 17:25
JimmyZ nom: say $.WHAT 17:26
p6eval nom d5729f: OUTPUT«Null PMC access in find_method('WHAT')␤ in block <anon> at /tmp/9IbCOYBrKM:1␤ in <anon> at /tmp/9IbCOYBrKM:1␤»
GlitchMr That... makes sense...
There is no $. variable...
And there is no "$"...
JimmyZ nom: say |.WHAT 17:27
p6eval nom d5729f: OUTPUT«Method 'FLATTENABLE_LIST' not found for invocant of class 'Any'␤ in block <anon> at /tmp/ex7qVHsPjd:1␤ in <anon> at /tmp/ex7qVHsPjd:1␤»
JimmyZ nom: say /.WHAT
p6eval nom d5729f: OUTPUT«␤use of uninitialized value of type Any in numeric context␤»
sorear JimmyZ: What exactly are you trying to do? 17:27
GlitchMr perl6: print ?.WHAT 17:28
This?
p6eval rakudo d5729f, niecza v12-49-ga117854: OUTPUT«False»
..pugs b927740: ( no output )
GlitchMr That makes sense...
Even if it's weird...
JimmyZ sorear: Just curious
TimToady perl6: say .WHAT
p6eval pugs b927740: OUTPUT«Scalar␤»
..rakudo d5729f, niecza v12-49-ga117854: OUTPUT«Any()␤»
JimmyZ TimToady: I wonder how about @% and %@ :) 17:29
GlitchMr @% what?
TimToady no point, since % in list context already has @ semantics
JimmyZ @(%a) :)
GlitchMr @{%a} 17:30
I see...
perl6: @((my %a = 1 => 2) + %a * 2) 17:31
p6eval pugs b927740, rakudo d5729f, niecza v12-49-ga117854: ( no output )
GlitchMr perl6: print @((my %a = 1 => 2) + %a * 2)
right
p6eval pugs b927740, rakudo d5729f, niecza v12-49-ga117854: OUTPUT«3»
GlitchMr :)
PerlJam perhaps my aversion to $@foo and such is just a hold-over from using Perl 5. I never dereference without braces in Perl 5 so as to avoid any potential confusion.
PerlJam (at least in multi-level data structures) 17:31
GlitchMr I still fail to notice major differences between Perl 5.14 and Perl 5.10... but that's just me... 17:32
perl6: print "\N{NEL}" 17:35
p6eval rakudo d5729f: OUTPUT«===SORRY!===␤Unrecognized backslash sequence: '\N' at line 1, near "{NEL}\""␤»
..niecza v12-49-ga117854: OUTPUT«===SORRY!===␤␤Unrecognized backslash sequence: '\N' at /tmp/7CFEe7iQI8 line 1:␤------> print "\N⏏{NEL}"␤␤Use of uninitialized value in string context␤ at /home/p6eval/niecza/boot/lib/CORE.setting line 773 (warn @ 2) ␤ …
..pugs b927740: OUTPUT«*** No such subroutine: "&NEL"␤ at /tmp/KQGvmwmwJ0 line 1, column 11-14␤»
GlitchMr Is it possible to use named escapes in Perl 6? 17:36
TimToady perl6: say "\c[WHITE SMILING FACE]" 17:37
p6eval niecza v12-49-ga117854: OUTPUT«===SORRY!===␤␤Action method charname not yet implemented at /tmp/nD5ViW0bRA line 1:␤------> say "\c[WHITE SMILING FACE⏏]"␤␤Action method charnames not yet implemented at /tmp/nD5ViW0bRA line 1:␤------> say "\c[WHIT…
..pugs b927740: OUTPUT«âº␤»
..rakudo d5729f: OUTPUT«☺␤»
GlitchMr perl6: print "\c[BELL]"
p6eval niecza v12-49-ga117854: OUTPUT«===SORRY!===␤␤Action method charname not yet implemented at /tmp/4IwR3p07KI line 1:␤------> print "\c[BELL⏏]"␤␤Action method charnames not yet implemented at /tmp/4IwR3p07KI line 1:␤------> print "\c[BELL⏏[31…
..pugs b927740, rakudo d5729f: OUTPUT«»
GlitchMr ... just wondering what would happen. 17:38
And I've heard a beep...
That's weird, considering that Perl 5.16 will not use BELL as BELL... 17:39
TimToady nom: say "\c[BELL SYMBOL]"
p6eval nom d5729f: OUTPUT«⍾␤»
GlitchMr BELL SYMBOL? 17:40
TimToady looks like a mushroom here...
GlitchMr It's BELL in Unicode, but whatever. 17:40
Unless it was changed?
TimToady .u ⍾ 17:41
phenny U+237E BELL SYMBOL (⍾)
lichtkind inverting hashes with several equal keys overwerites the previous pair? 18:01
TimToady use .push if you don't want that 18:02
perl6: my %hash; %hash.push: a => 1, a => 2, a => 3; say %hash.perl 18:03
p6eval pugs b927740: OUTPUT«pugs: Named argument found where no matched parameter expected: (a,Ann (Pos (MkPos "/tmp/bTXTNjqwPn" 1 28 1 29)) (Val (VInt 1)))␤»
..niecza v12-49-ga117854: OUTPUT«Unhandled exception: Unable to resolve method push in class Hash␤ at /tmp/lruBDD0Oa2 line 1 (mainline @ 1) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2229 (ANON @ 2) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2230 (module-CORE @ 58) ␤ at /home/…
..rakudo d5729f: OUTPUT«().hash␤»
TimToady heh 18:04
perl6: my %hash; %hash.push: (a => 1, a => 2, a => 3); say %hash.perl
p6eval niecza v12-49-ga117854: OUTPUT«Unhandled exception: Unable to resolve method push in class Hash␤ at /tmp/Wlu8frYgpK line 1 (mainline @ 1) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2229 (ANON @ 2) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2230 (module-CORE @ 58) ␤ at /home/…
..rakudo d5729f: OUTPUT«("a" => [1, 2, 3]).hash␤»
..pugs b927740: OUTPUT«*** Can't modify constant item: VUndef␤ at /tmp/Yv5bGyp8yV line 1, column 11-47␤»
lichtkind TimToady: say %songs.push.invert.perl; DOESNT WORK HERE FOR ME 18:05
sorry shift lock
TimToady push has to have arguments
lichtkind thanky you slowly i get it 18:08
so classify also uses push
TimToady: i that usage of push new?
colomon nope 18:09
well, for certain definitions of new. :)
lichtkind introduced in the last 12 month? 18:10
colomon nope, it's older than that 18:13
lichtkind so i was sleeping 18:15
but do i get a list of inverted pairs 18:17
moritz nom: my %h; %h.push() 18:19
p6eval nom d5729f: ( no output )
lichtkind %revert.push($_.invert) for %songs; ?? 18:20
lichtkind %revert.push(%nr.invert); 18:38
have it
thanks
lichtkind perl6: my %h = 2=>2; say exists %h<2>; 19:30
p6eval rakudo d5729f: OUTPUT«===SORRY!===␤CHECK FAILED:␤Undefined routine '&exists' called (line 1)␤»
..niecza v12-49-ga117854: OUTPUT«===SORRY!===␤␤Undeclared routine:␤ 'exists' used at line 1␤␤Unhandled exception: Check failed␤␤ at /home/p6eval/niecza/boot/lib/CORE.setting line 880 (die @ 2) ␤ at /home/p6eval/niecza/src/STD.pm6 line 1143 (P6.comp_unit @ 32) ␤ at /ho…
..pugs b927740: OUTPUT«*** No compatible multi variant found: "&exists"␤ at /tmp/7zlWWwKV6r line 1, column 19-31␤»
lichtkind perl6: my %h = 2=>2; say %h<2> ;exusts; 19:31
p6eval pugs b927740: OUTPUT«2␤*** No such subroutine: "&exusts"␤ at /tmp/mkHvH2FZUT line 1, column 26-32␤»
..niecza v12-49-ga117854: OUTPUT«===SORRY!===␤␤Undeclared routine:␤ 'exusts' used at line 1␤␤Unhandled exception: Check failed␤␤ at /home/p6eval/niecza/boot/lib/CORE.setting line 880 (die @ 2) ␤ at /home/p6eval/niecza/src/STD.pm6 line 1143 (P6.comp_unit @ 32) ␤ at /ho…
..rakudo d5729f: OUTPUT«===SORRY!===␤CHECK FAILED:␤Undefined routine '&exusts' called (line 1)␤»
lichtkind perl6: my %h = 2=>2; say %h<2> ;exists;
p6eval pugs b927740: OUTPUT«2␤*** No compatible multi variant found: "&exists"␤ at /tmp/RGYlCvim6S line 1, column 26-32␤»
..rakudo d5729f: OUTPUT«===SORRY!===␤CHECK FAILED:␤Undefined routine '&exists' called (line 1)␤»
..niecza v12-49-ga117854: OUTPUT«===SORRY!===␤␤Undeclared routine:␤ 'exists' used at line 1␤␤Unhandled exception: Check failed␤␤ at /home/p6eval/niecza/boot/lib/CORE.setting line 880 (die @ 2) ␤ at /home/p6eval/niecza/src/STD.pm6 line 1143 (P6.comp_unit @ 32) ␤ at /ho…
moritz it helps to spell the colon correctly 19:32
lichtkind perl6: my %h = 2=>2; say %h<2> :exists;
p6eval niecza v12-49-ga117854: OUTPUT«Bool::True␤»
..pugs b927740: OUTPUT«pugs: Named argument found where no matched parameter expected: (exists,Val (VBool True))␤»
..rakudo d5729f: OUTPUT«===SORRY!===␤Confused at line 1, near "say %h<2> "␤»
lichtkind maybe :)
lichtkind thanks 19:35
lichtkind huhu exists is gone as i knew it 19:36
sorear TimToady: ping... 19:43
phenny: tell TimToady I am wondering why assertion:variable uses <EXPR(%LOOSEST)>. Is <$foo = $bar> supposed to mean something?
phenny sorear: I'll pass that on when TimToady is around.
lichtkind jnthn: ping 20:12
felher moritz++: nice blogpost. Also +1 on allowing $@something; :) 20:28
ruoso_ hi all 20:32
sorear o/ ruoso_ 20:37
haven't seen you in a while
ruoso_ I need to find a new rythm to resume my open-source life
between work and kid I haven't been doing anything lately 20:38
sorear hehe, I've heard that a lot 20:38
ruoso_ and it's a shame, since a lot of exciting stuff is happening around here.. 20:39
like the implementation of the REPR API in rakudo... 20:42
speaking of which... is there any idea of when we're getting the rakudo star releases again? 20:43
sorear There was talk of one this month
moritz ruoso_: we want to make a star release based on the December compiler release 20:50
ruoso_: most regressions from the transition to nom are now fixed, and the native call interface mostly works again
ruoso_ That's cool... is this the same transition that is getting rid of most of the PIR in the Perl6-level code? 20:51
sorear Yes 20:52
moritz $ ack Q:PIR src/core/ |wc -l 20:53
12
ruoso_ That is really cool...
moritz nom: try eval q[class A { $!undeclared } ]; say $!.perl 20:54
p6eval nom d5729f: OUTPUT«X::Attribute::Undeclared.new(name => "\$!undeclared", package-type => "class", package-name => "A", filename => "/tmp/pIOvP9ELJy", line => 1, column => Any, message => "Attribute \$!undeclared not declared in class A")␤»
moritz ruoso_: that's also new, we can now throw typed exceptions from within the compiler 20:55
sorear that's _very_ new
moritz aye :-)
moritz 4 days old 20:55
ruoso_ :) 20:56
sorear the namesake feature of nom is a complete new object model
it's very SMOP-inspired
and with that came a lot of other refactorings
ruoso_ Yes, I am very very happy to see that SMOP was helpful in the end :)
sorear rakudo is now a _worthy_ opponent :P
ruoso_ So at this point we're actually close of bootstrapping rakudo over nqp... 20:57
sorear huh?
we're not leaving nqp 20:58
ever, afaict
ruoso_ that's not what I meant
what I meant is that porting rakudo to a different vm would be possible by porting nqp
in that sense nqp would be a "bootstrapping" language 20:59
moritz
.oO( chromatic's dread )
ruoso_: yes, but it's much more work than just porting nqp
lots of codegen and runtime stuff is also vm dependent 21:00
ruoso_ Oh... right... you would need a new emitter
sorear the emitter is part of nqp, really 21:01
moritz not yet
sorear rakudo shares the nqp emitter with very tiny overrides
oh?
ruoso_ but my point is that one could make nqp have multiple emitters... 21:02
sorear Yes.
moritz in fact there's a nqplua backend, on which diakopter++ has been working a bit 21:03
ruoso_ so porting rakudo would mean porting nqp+writing a new emitter
sorear also nqp# and jnqp, which are much better 21:03
diakopter nqplua doesn't emit anything though. it's dependent on parrot-nqp anyways
like nqpclr
sorear but nowhere near good enough to run rakudo
or themselves, as diakopter points out 21:04
ruoso_ wonders if it would be possible to port nqp to perl5guts
moritz possible, but probably not a good idea 21:05
ruoso_ why?
moritz too different primitives, and not low-level enough to be still efficient when combined to emulate the perl 6 stuff
diakopter a bunch of nqp is in C after all 21:06
sorear moritz: I think ruoso is talking about writing our own set of primitives, but using the Perl 5 data types 21:06
ruoso_ Yes 21:07
sorear and the Perl 5 dispatch loop
ruoso_ exactly
sorear the main problems with this approach are the differences like "in Perl 6, an Int is an object, with identity"
ruoso_ well, that is the semantics interoperability issue, not the "running perl6" issue 21:09
lichtkind moritz: i'm 80% done, wanne have a look at it?
sorear ruoso_: another problem is that nqp doesn't use containers 21:11
ruoso_ containers in the Perl 6 sense?
sorear there would be a substantial penalty to a perl5/nqp/rakudo stack because containers would have to be reimplemented at a higher level, ignoring the perl 5 containers
containers = Scalar, struct SV
a common Perl concept 21:12
ruoso_ well, yeah... perl5 doesn't have containers...
perl5 only have values
but why would that penalty be bigger with the p5 core than with the parrot core? 21:14
lichtkind any other people here involved in advent calendar? 21:17
jnthn home at last 21:48
tadzik home at... hey!
jnthn :P
5 hour decommute was, at least, comfy and with wifi 21:49
slavik1 ....
jnthn slavik1: Train from Stockholm down to south of Sweden :) 21:51
I would say not a regular commute, though I've done the trip twice this month. :)
And have got it at least once next month.
slavik1 oh
jnthn: so you heard of this guy named Jonathan Walsh? 21:52
jnthn slavik1: No...should I have? :) 21:53
slavik1 he was on the front page of some swedish paper 21:54
I thought swedes were all gamers and such
slavik1 dreamhack, starcraft2, doesn't ring a bell? 21:55
jnthn Ah...I've never been a gamer. But yeah, it's popular here.
sorear at least you have decent trains
jnthn ain't Swedish, just living in Sweden :)
slavik1 oh, ok
how is sweden? I was told you don't need to know a word of swedish ... 21:56
tadzik orka!
jnthn sorear: Yes, I'm happy about that. Especially as I'm not allowed to drive a car. :)
slavik1: It's pretty nice here. You can certainly get by with English, but it would feel odd to live in a country and not at least do the trivial things in the local language. So I'm learning...slowly. :) 21:57
sorear jnthn: Is that because you're a filthy foreigner, or because the Swedes are sensible enough to outlaw private car ownership? 21:58
jnthn sorear: Neither. It's 'cus I don't have good enough eyesight to drive safely.
(Retina condition, so basically unfixable.) 21:59
Makes me very glad to be in Europe, where public transport generally exists, and in many places can be pretty good.
slavik1 NYC has decent public transportation 22:00
best in the country :(
jnthn To be fair, it's not just Europe where it's good. 22:00
I had little problem getting around in Japan, China, Russia, etc. 22:01
tadzik did you experience Japan subway in the rush hours?
jnthn tadzik: I avoided it...right until my very last day there, when the time of my flight meant I ahd to experience it at rush hour. 22:02
"experience" is certainly the word for it. :)
tadzik hah
were you pushed in by the pushers? :P
jnthn I've never actually felt like any form of transport I've been on since was crowded. :)
jnthn tadzik: No, folks seemed quite capable of sardining themselves onto the subway in general. :) 22:03
tadzik I consider subway to be crowded when you cannot fall down, even if you faint or whatever
haha, the sardines analogy seems quite international :P
dalek p: d3bf21d | jnthn++ | src/6model/reprs/CPointer.c:
Fix storage spec for CPointer repr; flussence++ for reporting the bug and testing the patch.
22:07
lichtkind tadzik, jnthn someone to chekc my article so far? 22:24
raiph comments.assuming(@listener>0) 23:33
try.rakudo.org doesn't work; ideone.com does; perlcabal.org/~fglock/perlito.html is great; maybe update perl6.org? 23:35
stackoverflow: perl6 tag; 91 followers; 50 questions; 21 this year; none unanswered; 23:37
sorear huh? 23:39
PerlJam read "none unanswered" as "none answered" at first
sorear Those look like facts and statistics to me, not comments ... is there subtext I'm missing? 23:40
raiph hi sorear 23:41
sorear hello raiph
raiph sorear: just that one advantage of perl6's current situation is the relative responsiveness of its community 23:45
dalek ecza: c2f6274 | sorear++ | / (6 files):
Add <$foo> and <@foo>
raiph 3 stackoverflow perl6 questions look like they could maybe do with a better / updated answer: 23:48
stackoverflow.com/questions/5031737...g-question
stackoverflow.com/questions/4516057...-in-perl-6
stackoverflow.com/questions/3135673...ons-mature
i've read enough to make me think things have moved on since the answers, but not enough to think i can give those better answers 23:50