»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
AlexDaniel huggable: The Hundred-Year Language 00:23
huggable AlexDaniel, nothing found
AlexDaniel huggable: The Hundred-Year Language :is: www.paulgraham.com/hundred.html 00:24
huggable AlexDaniel, Added The Hundred-Year Language as www.paulgraham.com/hundred.html
Geth ecosystem: 2429b032f1 | (David Warring)++ | META.list
add PDF::API6 - General purpose PDF librARY (WIP)
00:49
Geth ecosystem: f88f36bfe1 | (David Warring)++ | META.list
fix PDF::API6 url
01:05
Todd_ May I mooch some help with a one liner? vpaste.net/WoTgJ 01:19
ugexe map is not grep 01:22
Todd_ I dumb dumb how would you do it ina one liner? 01:24
This is what I am trying to replace: 01:25
Device=$(ls -al /dev/disk/by-partlabel | sed -e 's/-//g' | awk '{print $9, " " $11}' | grep -i "lin-bak" | awk -F "../../" '{print $2}')
raschipi I got this so far: 01:33
m: ls -al /dev/disk/by-label/ |perl6 -e '.say for lines.map(*.split(" ")).map(*.[9,11])
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3ls -al /dev/7⏏5disk/by-label/ |perl6 -e '.say for lines
expecting any of:
infix
infix stopper
postfix
statemen…
Todd_ a better one
ls -al /dev/disk/by-partlabel | grep -i "lin-bak" | awk '{print $11}' | sed -e 's/..\/..\///'
Todd_ I got it, but it is a bit long and weird: 01:45
ls -al /dev/disk/by-partlabel | /usr/bin/perl6 -e 'my @x=lines; for ( @x ) -> $y {if ( $y ~~ /"lin-bak"/ ) { (my $z = $y ) ~~ s|.*"../../"||; say "$z"}}'
ls -al /dev/disk/by-partlabel | /usr/bin/perl6 -e 'my @x=lines; for ( @x ) -> $y {if ( $y ~~ /"lin-bak"/ ) { (my $z = $y ) ~~ s|.*"../../"||; say "$z"; last}}'
raschipi m: use MONKEY-GUTS;my @l = "/dev/disk/by-label/".lines.map(*.IO.dir.Str);say nqp::readlink $_ for @l
camelia Failed to get the directory contents of '/dev/disk/by-label': Failed to open dir: 2
in whatevercode at <tmp> line 1
in block <unit> at <tmp> line 1
Todd_ ls -al /dev/disk/by-partlabel | /usr/bin/perl6 -e 'my @l = "/dev/disk/by-label/".lines.map(*.IO.dir.Str);say nqp::readlink $_ for @l' ===SORRY!=== Error while compiling -e Could not find nqp::readlink, did you forget 'use nqp;' ? at -e:1 ------> p(*.IO.dir.Str);say nqp::readlink $_ for⏏ @l 01:46
raschipi Yeah, missing the "use nqp" or "use MONKEY-GUTS" 01:47
Todd_ would you show me the whole line? 01:49
araraloren ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).say for lines[1..*]' 01:57
Todd_ how do I get rid of the leading space? 02:00
araraloren Todd_, .trim 02:22
Todd_ where do I put the trim? 02:25
araraloren Hmm, before the result print 02:27
Todd_ ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).say for trim.lines[1..*]' 02:29
doesn't work
araraloren ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).trim.say for lines[1..*]' 02:30
araraloren This should work 02:30
Todd_ ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).trim.say for lines[1..*]' sdd1
Thank you!
Geth doc: 72607fab64 | (Will "Coke" Coleda)++ | doc/Type/Iterable.pod6
remove trailing whitespace
02:31
raschipi m: my $i = 3.2/500; my @a = 1,(* × (1 + $i))...∞; say 500 * @a[18] #Neat! 02:58
camelia 560.843008310062
ckraniak FormatMessage now working, pointers confirmed for sucking in every language 03:01
raschipi Perl6 doesn't have pointers, yay. 03:04
ckraniak ... well I've been dealing with native call 03:06
But now that it works I know the incantation!
raschipi Are you happy with the way P6 does it? 03:07
ckraniak It's ok. Half the trouble is needing to prod and see if Windows will take a CArray[uint16] in LPTSTR places vs a Str is rw or whichever 03:11
ckraniak Learning you have to explicitly make a void pointer instead of passing in 0 03:12
I haven't even tried the DWORD_PTR array part yet 03:13
ckraniak I like Perl 6 in general a lot though 03:17
BenGoldberg ckraniak, You don't have to pass, say, Pointer[void] specificially -- you could just pass in Pointer. 03:21
araraloren you can replace CArray[uin8] with buf16 03:28
ckraniak The other thing this could use is more examples of what I've done here 03:50
Not something I could find on stackoverflow, or github etc. else I wouldn't be bugging y'all 03:51
araraloren ckraniak, what are trying to do ? 04:00
ckraniak WinAPI garbage. Hit of a language learning exercise 04:01
ckraniak s/hit/bit/ 04:01
raschipi ckraniak: NativeCall does lack documentation. I think they didn't went all out about it because most of this stuff isn't finalized yet. 04:03
araraloren yeah, should do some dig use NativeCall before write real code 04:04
coetry What is recommended if I want to see step by step how perl6 code is being executed? Something like a call stack or something. Like I want to see it all layed out. 06:27
I'm in the repl and trying to do an html dump from Data::Dump::Tree::DHTML, and it seems that its hanging when trying to dump an XML node 06:28
the xml file is 6499 lines and I slurped it all up in a single scalar 06:30
renormalist DrForr_: is the module from your talk about parsing Perl6 with Perl6 (which gave detailed character positions of symbols etc) online somewhere? 07:35
gfldex renormalist: github.com/drforr/perl6-Perl6-Parser 07:36
renormalist gfldex: thanks! 07:37
pmurias is back home after TPC::EU 07:57
Geth Inline-Perl5: 04a774ccf8 | (Stefan Seifert)++ | lib/Inline/Perl5.pm6
Speed up invoke-args a tiny bit by using a lower level type check

We really only care about supporting => syntax for passing named arguments, i.e. basic Pair objects, not any hypothetical subclasses. So we may use a cheaper check to match the exact type instead of using .isa
08:15
Geth Inline-Perl5: b92d7b1ce4 | (Stefan Seifert)++ | 2 files
Version 0.29
08:22
lisbeths I've got to get similar functionality to the system function in perl 08:45
I've tried run but it gives me this strange output rather than the terminal output 08:46
pmurias is there stuff that's discouraging people from contributing to the Perl 6 docs? 08:48
lisbeths Probably not
moritz lisbeths: please show some example code. run() is supposed to work 08:52
lisbeths sub system($x, $y){qq:x/$x "$y"/} 08:58
system("echo", "hello")
Only I need it to be one string and not two 08:59
moritz then use shell(), not run() 09:00
ryu0 my $x = "echo", $y = "hello"; say "'$x' '$y'";
m: my $x = "echo", $y = "hello"; say "'$x' '$y'"; 09:01
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$y' is not declared
at <tmp>:1
------> 3my $x = "echo", 7⏏5$y = "hello"; say "'$x' '$y'";
ryu0 m: my $x = "echo"; my $y = "hello"; say "'$x' '$y'";
camelia 'echo' 'hello'
lisbeths It seems like a complicated way to do that though
I should be able to do it with a single string
ryu0 lisbeths: you can reference variables in "" string literals to include their text form. 09:02
moritz perl6 -e 'my $str = q[echo "hello, wolrd"]; shell $str'
hello, wolrd
ryu0 that's one option.
lisbeths My subroutine already works almost how I like except that I have to break a string into two pieces 09:03
I have to get the string leading up to the first space and the string after the first space
moritz $str.split(' ', 2) 09:12
pmurias Why do I get an exception 'This types (Scalar) does not support positional operations' without a backtrace? 09:38
pmurias it's optimizer complaining of Scalars getting mixed up into QAST because of NQP crappiness 09:46
lizmat pmurias: generally that indicates a missing decont 09:49
m: use nqp; my $l = nqp::list(42); dd nqp::atpos($l,0) 09:50
camelia This type (Scalar) does not support positional operations
in block <unit> at <tmp> line 1
lizmat m: use nqp; my $l := nqp::list(42); dd nqp::atpos($l,0) # either bind
camelia 42
lizmat m: use nqp; my $l = nqp::list(42); dd nqp::atpos(nqp::decont($l),0) # or decont
camelia 42
ryu0 ... what is this dd i keep seeing pop up? 09:54
m: dd 1
camelia 1
ryu0 m: dd
camelia block <unit>()
ryu0 m: say
camelia 5===SORRY!5===
Argument to "say" seems to be malformed
at <tmp>:1
------> 3say7⏏5<EOL>
Other potential difficulties:
Unsupported use of bare "say"; in Perl 6 please use .say if you meant to call it as a method on $_, or use an exp…
ryu0 weird.
lizmat ryu0: dd is Rakudo Parl 6's built-in tiny data dumper 09:56
so tiny it lost the t
ryu0 Oh. So it's an implementation detail.
lizmat basically it does a "note $foo.perl" 09:57
m: note 1.perl
camelia 1
yati Hi people. How can I force rakudo to give the full stacktrace when something goes wrong? Somewhat like Carp::confess from perl 5? 10:37
And on a related note, is there an equivalent of local *__ANON__ = "foo" so I can name my lambdas? 10:39
renormalist in a given/when, is there some statement that gets called once iff some of the "when" matched? like a conditional fallthrough? 10:48
conditional default,I mean 10:49
ryu0 yati: --lt-exception when running perl6 might be your answer. 10:50
ryu0 yati: --ll-exception * 10:50
pmurias renormalist: you mean a statement that gets called if nothing matches? 10:51
renormalist: I mean if something matches
renormalist yes, if something
I try to find a pastie to show my silly given/when 10:52
pmurias renormalist: you can achieve that with a default+flag variable+if statement 10:53
renormalist gist.github.com/renormalist/f26df5...4d9f82367a 10:54
renormalist ah, I could reverse my bool $f and reset it in default{} 10:55
pmurias: ^ see my own comment in above gist, is that what you mean? 10:56
pmurias renormalist: yes 10:57
tyil lizmat: h-hi 11:11
lizmat tyil o/
tyil I got disconnected from the irc last night it seems 11:12
was there still a hackathon?
me and sam could still come
moritz PSA: I'll be updating irc.p6c.org to Debian Stretch soon 11:27
that will require a reboot 11:28
stmuk ha! cperl is claimed to be getting macros 11:29
El_Che stmuk: and grammars 11:41
moritz really? 11:55
ryu0 wouldn't surprise me. some P6 features are getting backports to P5 in some way.
moritz I guess the p5 regex engine has most of the infrastructure already 11:57
it supports named regexes and named captures, though with a somewhat obscure syntax
the thing it doesn't support yet is nested match objects 11:58
evanm Does anyone know what this error means? "No such method 'cache' for invocant of type 'NQPMu'" 11:59
evanm It's happens during a call to "await", but I have no idea what it's talking about 12:02
moritz sounds a like a pretty low-level, internal error 12:04
are the things you pass to await promises?
evanm moritz: yes, they're promises 12:05
For context, it happens here: github.com/scmorrison/uzu/blob/mas...r.pm6#L401 12:06
The full error stack is in the last comment here: github.com/scmorrison/uzu/issues/10 12:07
moritz that looks fine 12:11
(I'd write that as my @language_queue = $config<language>.map: { start { ... } }; but that's just stylistic choice; won't change the error
)
lizmat tyil: sorry, missed it: 12:12
seems damnlie is going to TechInc, but have no ETA for that 12:13
andreoss is there a way for roles/classes to use its child types in a base class definition? 12:14
moritz if you predeclare the child class, yes 12:15
damnlie We are at techinc 12:16
andreoss moritz: with proto?
moritz but that requires both to be in the same compunit (aka file)
m: class Child { ... }; class Parent { has Child $.x }; class Child is Parent { }
camelia ( no output )
moritz andreoss: ^^ like this
evanm moritz: Should I file a bug against Rakudo? 12:18
moritz evanm: yes. And as a workaround, you could try to use hyper with a limited number of jobs: docs.perl6.org/routine/hyper 12:19
uzu looks interesting 12:20
do you happen to know if it supports writing pages in markdown, and rendering them as part of the build? 12:21
evanm moritz: I've asked about this, MD support is planned but not implemented 12:22
It's a nice project, scmorrison is very active & responsive with feature requests 12:23
moritz I have plans for a new personal website for myself; this looks like a good candidate 12:25
evanm I've been moving my personal website over to it... so far it looks like a good decision 12:27
moritz I guess I should start with a concept about what should be on that site :-) 12:28
moritz [Coke], masak, pmichaud_: I need to reboot irc.p6c.org because of a OS level upgrade. When would a convenient time be? 12:29
if nobody objects, I'll do it tonight around 20:00H CEST (1800H UTC, if my memory of time zones is correct) 12:30
andreoss p: role Foo {...}; role Bar does Foo {...} ; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar { method abs {1}}; say Foo.bar.abs; 12:33
m: role Foo {...}; role Bar does Foo {...} ; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar { method abs {1}}; say Foo.bar.abs;
camelia Method 'abs' must be implemented by Foo because it is required by roles: Foo.
in block <unit> at <tmp> line 1
andreoss why it must be implemented by Foo? 12:36
it seems it doesn't see Bar.abs at this point 12:37
ryu0 andreoss: because the parent role has no implementation for that method.
Or so it looked.
andreoss it's supposed to be abstract
ryu0 what's so hard to understand? the method must have an implementation because you're saying it implements the methods of Foo. 12:38
if there is no implementation, then it doesn't really implement it fully. 12:39
andreoss m: role Bar {...}; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar does Foo { method abs {1}}; say Foo.bar.abs; 12:39
camelia Method 'abs' must be implemented by Foo because it is required by roles: Foo.
in block <unit> at <tmp> line 1
andreoss Bar has concrete abs method. I call.abs on Bar object, but somehow it complains about Foo which is abstract (methods are stubbed) 12:41
m: role Bar {...}; role Foo { method abs {die} ; method bar { Bar.new } }; role Bar does Foo { method abs {1}}; say Foo.bar.abs; 12:42
camelia 1
andreoss but this works
though Foo.abs is never called
ryu0 m: role Bar {...}; role Foo { method abs {...} }; 12:43
camelia ( no output )
ryu0 m: role Bar {...}; role Foo { method abs {...} }; role Bar does Foo { method abs {1} }; 12:43
camelia ( no output )
ryu0 m: role Bar {...}; role Foo { method abs {...} }; role Bar does Foo { method abs {1} }; say Bar.abs;
camelia 1
ryu0 m: role Bar {...}; role Foo { method abs {...} method bar { Bar.new } }; role Bar does Foo { method abs {1} }; 12:44
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3e Bar {...}; role Foo { method abs {...}7⏏5 method bar { Bar.new } }; role Bar does
expecting any of:
in…
ryu0 m: role Bar {...}; role Foo { method abs {...}; method bar { Bar.new } }; role Bar does Foo { method abs {1} };
camelia ( no output )
ryu0 m: role Bar {...}; role Foo { method abs {...}; method bar { Bar.new } }; role Bar does Foo { method abs {1} }; say Foo.bar;
camelia Method 'abs' must be implemented by Foo because it is required by roles: Foo.
in block <unit> at <tmp> line 1
ryu0 My guess? Cyclical reference. 12:45
Notice it only appears when the parent role references the child role.
andreoss aslo it works with classes
ryu0 Huh.
Wait for someone more knowledgeable I guess. 12:46
andreoss m: class Bar {...}; class Foo { method abs {...} ; method bar { Bar.new } }; class Bar is Foo { method abs {1}}; say Foo.bar.abs
camelia 1
moritz when you say "Foo.bar" (in the roles example), rakudo tries to pun the role Foo into a class Foo that implements that role 12:49
and that point, it fails, because it contains a method stub
basically, a role that contains a stub method is explicitly incomplete (like an interface in Java) 12:51
ryu0: ^^
andreoss any way to use the actual method defined later other than not using a stub? 12:54
moritz andreoss: if it's implemented in Bar, call Bar.abs 12:55
andreoss: or compose Bar into a class, and use the class
andreoss i use roles because i need parametic property
moritz m: class Foo { method abs { ... } }; class Bar is Foo { method abs { 1 } }; Foo.abs 12:56
camelia Stub code executed
in method abs at <tmp> line 1
in block <unit> at <tmp> line 1
moritz same error with classes: you have to reference the implementation, not the stub, to use it
pmurias wow, modules.perl6.org looks good now 13:03
tremendous upgrade from looking like shit :)
moritz PSA: Apress will publish leanpub.com/perl6regex/ so I have to pull it off leanpub Very Soon[tm] 13:04
andreoss m: role Bar {...}; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar does Foo { method abs { 1 }}; my Bar $b = Foo.bar; say $b.^methods;
camelia Method 'abs' must be implemented by Foo because it is required by roles: Foo.
in block <unit> at <tmp> line 1
andreoss Bar.new is being constructed from `role Bar {...}` not from the latter definition, is it correct? 13:05
moritz yes 13:06
but calling a method on Foo tries to pun the role 13:07
Foo.bar is something like (anon class Foo does Foo { }).bar
and that it what doesn't work
andreoss can i reffer to the latter concrete definition somehow? 13:08
moritz what do you mean by "latter concrete defintion" here?
andreoss the second one `role Bar does Foo ...`
without a stub 13:09
moritz m: m: role Bar {...}; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar does Foo { method abs { 1 }}; my Bar $b = Bar.bar; say $b.^methods
camelia (bar abs)
moritz andreoss: ^^ sure
just use Bar, not Foo
and you're good
El_Che moritz: you're becoming quite the author
nice
moritz El_Che: :-)
andreoss the point was to create a Bar object from the Foo role
i.e use Foo as a factory 13:10
moritz and if that works well, I'll rework my book on Continuous Delivery book into CI/CD for python, and have it published too
andreoss: you can't use Foo as a factory; it's abstract
just like you can't use a Java Interface as a factory
andreoss but I still can call ::?CLASS:U methods on it 13:11
ryu0 tries to make a concrete factory but gets abstract errors.
moritz andreoss: on subclasses that implement all stub methods, not on Foo itself
moritz (or roles, not just classes) 13:11
if you need a factory, have a separate role or class for it 13:12
araraloren it's like Foo is one component of that role/class
andreoss okay, it seems i get it now 13:13
araraloren have you read perl6 introduction perl6intro.com/ ? 13:14
araraloren andreoss, it's a good tutorial :) 13:14
andreoss probably some long time ago 13:15
moritz would recommend his book, but it doesn't go deep into roles
andreoss there's not so much materials available on parametric roles and stuff that can be done with them 13:16
so many 13:18
El_Che moritz: in my mind the languages that are creating some buzz (next to the nth JS framework) are Go and Rust. Python, not so much 13:27
evanm moritz: just fyi I've filed a couple of bugs with "await". One's a segfault :-/ rt.perl.org/Ticket/Display.html?id=131888 rt.perl.org/Ticket/Display.html?id=131889 13:29
jnthn Do they go away if use v6.d.PREVIEW is removed? 13:31
El_Che moritz: I hope you get feedback from the people that brought your book at TPCiA
evanm jnthn: I still see the segfault in #131889 after removing v6.d.PREVIEW 13:32
synopsebot6 Link: rt.perl.org/rt3/Public/Bug/Display...?id=131889
jnthn Hm, OK 13:32
El_Che hi jnthn 13:33
fyi #perl6: I was under the impression that there was a possitive vibe regarding perl6 at tpcia 13:34
jnthn o/ El_Che
El_Che (of course subjective as hell, but that was my impression)
Damian's talk helped of course 13:35
(but personnaly, it was jnthn's talk at fosdem some years ago that got me exited about the lang) 13:36
AlexDaniel evanm: would be great if the code was golfed down a little bit so that it's easier to see where the issue is. It's not that hard to achieve a segfault (e.g. RT #128870), but it's not always rakudo/moarvm's fault 13:41
synopsebot6 Link: rt.perl.org/rt3/Public/Bug/Display...?id=128870
AlexDaniel evanm: I'm saying this because I had tens of cases when I was cursing on rakudo/moarvm but then realized that I was doing something very dumb :) 13:43
evanm AlexDaniel: sure, it could be a bug in the application code, but unless there's NativeCall involved I'd think a segfault indicates a VM bug 13:50
as jnthn states in the issue you linked, "SEGV isn't an OK failure mode." 13:51
andreoss m: (Array[Int]).WHAT.say; 14:33
camelia (Array[Int])
andreoss how can i get Int from it?
timotimo m: say Array[Int].of.perl 14:38
camelia Int
andreoss timotimo: what about general case? 15:13
timotimo hmm good question 15:15
might have to rely on the role itself to expose its parameters to users 15:16
andreoss m: role Foo[::A]; Foo[*].WHAT.say; 15:19
camelia 5===SORRY!5=== Error while compiling <tmp>
Semicolon form of 'role' without 'unit' is illegal. You probably want to use 'unit role'
at <tmp>:1
------> 3role Foo[::A];7⏏5 Foo[*].WHAT.say;
andreoss m: role Foo[::A]{}; Foo[*].WHAT.say;
camelia (Foo[Whatever])
andreoss m: role Foo[::A]{}; Foo[*].^lookup('new').say;
camelia No such method 'lookup' for invocant of type 'Perl6::Metamodel::CurriedRoleHOW'
in block <unit> at <tmp> line 1
timotimo oh
m: .perl.say for Array[Int].^role_arguments() 15:20
camelia No such method 'role_arguments' for invocant of type 'Perl6::Metamodel::ClassHOW+{<anon>}+{<anon>}'
in block <unit> at <tmp> line 1
timotimo oh, that's only the CurriedRoleHow
so
timotimo m: for Array[Int].^roles -> $r { for $r.^role_arguments -> $a { $a.perl.say } } 15:20
camelia Int
No such method 'perl' for invocant of type 'TValue'
in block at <tmp> line 1
in block <unit> at <tmp> line 1
timotimo m: for Array[Int].^roles -> $r { for $r.^role_arguments -> $a { try $a.perl.say } } 15:21
camelia Int
No such method 'role_arguments' for invocant of type 'Perl6::Metamodel::ParametricRoleGroupHOW'
in block <unit> at <tmp> line 1
timotimo well, would have to grep for the CurriedRoleHOW
andreoss m: role F[::A] {}; F[Int].^role_arguments[0].say; 15:22
camelia (Int)
andreoss m: Array[Int].^role_arguments[0].say;
camelia No such method 'role_arguments' for invocant of type 'Perl6::Metamodel::ClassHOW+{<anon>}+{<anon>}'
in block <unit> at <tmp> line 1
andreoss how is Array a class and parametric? 15:25
timotimo every role can be used as a class 15:26
m: role See[$this] { }; See[1].new.perl.say
camelia See[Int].new
timotimo m: role See[$this] { }; See[1].HOW.^name.say
camelia Perl6::Metamodel::CurriedRoleHOW
andreoss but Array is not a role 15:27
timotimo m: role See[$this] { }; See[1].new.HOW.^name.say
camelia Perl6::Metamodel::ClassHOW
timotimo let me have a look
the important bits are in TypedArray.pm 15:28
it's a class with a .^parameterize method
andreoss the brackets don't match for some reason 15:35
timotimo yeah 15:36
these pm files are really just concatenated into one gigantic file
andreoss m: package A { our proto f($) {*} }; package A { our multi f(1) { "one" }}; 16:12
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use 'our' with individual multi candidates. Please declare an our-scoped proto instead
at <tmp>:1
------> 3 }; package A { our multi f(1) { "one" }7⏏5};
expecting any of:
h…
timotimo i didn't know you could re-open a package just like that 16:14
andreoss are packages file-scoped?
andreoss m: package A { sub f($) { 1 } }; package A { sub g { f(0) }}; say A::g(); 16:15
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
f used at line 1
andreoss seems not
timotimo "file-scoped"? 16:16
andreoss i thought one could re-open package if it's kept in a sigle file
timotimo it'd be nice if it properly warned if this isn't explicitly a feature 16:17
mst andreoss: subroutines are lexical, so obviously f() won't be in scope for g() 16:19
timotimo oh, right, you dropped the "our" there
andreoss m: package A { our sub f($) { 1 } }; package A { our sub g { f(0) }}; say A::g(); 16:20
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
f used at line 1
andreoss m: package F {}; say F.^archetypes; 16:35
camelia Too many positionals passed; expected 1 argument but got 2
in block <unit> at <tmp> line 1
timotimo m: package F {}; say F.HOW.archetypes 16:36
camelia No such method 'gist' for invocant of type 'Perl6::Metamodel::Archetypes'. Did you mean 'isa'?
in block <unit> at <tmp> line 1
timotimo heh.
timotimo archetypes doesn't take the $object argument that the .^ notation helpfully gives you for free 16:37
andreoss i believe it should be `method archetypes($obj) ...`
timotimo well, all of rakudo uses it like Thing.archetypes.something 16:37
timotimo or rather Thing.HOW.archetypes.something 16:38
timotimo i'll be AFK for a bit 16:38
araraloren why `package A { sub f($) { 1 } }; package A { sub g { A::f(0) }};` not produce redeclaration error ? 16:39
andreoss because of local scope? 16:40
m: my package A { our sub f($) { 1 } }; my package A { our sub g { f(0) }}; say A::g();
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
f used at line 1
araraloren I just know they don't like namespace in c++, in c++ we can separate namespace into multi file 16:41
m: package A { our sub f($) { 1 } }; package A { our sub g { A::f(0) }}; say A::g(); 16:42
camelia 1
araraloren AFK a little too 16:42
andreoss araraloren: this doesn't work across files though 16:45
araraloren andreoss, yeah, that's what I mean above 16:58
smls m: role R { method x { "Role wins!" } }; class A does R { has $.x = "Attr wins!" }; say A.new.x; 17:10
camelia Role wins!
smls ^^ Is a method from a role supposed to override an auto-generated attribute accessor of the class, rather than the other way around? 17:11
moritz yes 17:13
the role composition comes first
moritz and the attribute only generates an accessor if the class doesn't have a method of that name 17:13
smls In that case, could the `has $.x` maybe throw a warning here, suggesting to write `has $!x` because that's what it ends up doing anyway? 17:14
moritz m: role R { method x { "Role wins!" } }; class A { has $.x = "attr wins"; does R }; A.new.x
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
does used at line 1
moritz m: role R { method x { "Role wins!" } }; class A { has $.x = "attr wins"; also does R }; A.new.x
camelia ( no output )
moritz m: role R { method x { "Role wins!" } }; class A { has $.x = "attr wins"; also does R }; say A.new.x
camelia Role wins!
moritz seems to happen at compile time anyway 17:15
andreoss can i export routines imported from another module?
or anything like perl5's Import::Into? 17:16
moritz I think re-exporting is not yet implemented 17:16
smls moritz: "the attribute only generates an accessor if the class doesn't have a method of that name" -- Do you know why that is? 17:18
Is there a reason to write `$.foo` instead of `$!foo` if one doesnt't want the accessor generated? 17:20
smls I changed my class code to `has $!foo; method foo { $!foo }` now... I just worry that my future self (or another person modifying the code down the line) will look at it and think "Hey, this could be written more simply with an auto-accessor!" and break it again, and the compiler won't complain. 17:27
araraloren smls, as jnthn++ said, the accessor only generate when missing 17:33
araraloren and I think one common reason is you can use named argument in default constructor 17:36
araraloren $!foo mean private attribute, and you need provide BUILD if you want set foo with named argument 17:38
smls araraloren: Ah, you mean people intentionally use a `$.` attribute and a method with the same name, so that they can initialize the attribute with the default constructor but still manually control what the accessor returns? 17:41
Never thought of that. 17:43
smls Wondering if it was always like that... 17:52
bisectable6: class A { has $.x = 1; method x { 2 } }; say A.x;
bisectable6 smls, On both starting points (old=2015.12 new=93a5eff) the exit code is 0 and the output is identical as well
smls, Output on both points: «2»
smls ok :) 17:53
smls PS: Another possible reason for concern (other than the work-around practically inviting people to re-break it), is that it can cause 'action at a distance'. In fact that's how I hit the issue: 17:59
smls I had working code where a role privided a stub method `method x {...}`, and classes implemented it. Then I changed to stub to a default implementation, and didn't expect that to affect the already working classes... 18:00
smls But it broke the class that used a `$.` attribute as its implementation of the method, and the breakage only manifested (in an annoying-to-track-down way) at run-time. 18:01
smls If the only reason for the current behavior is to make "auto-constructor but manual accessor" possible, I wonder if there's not a better way that could have been done (or can be in 6.d), e.g. a trait for `$!` attributes to add them to the auto-constructor? 18:05
araraloren smls, hmm, I got you, have no idea. 18:08
geekosaur smls, thing is a similar argument can be made in the other direction "hey, we told it to gnerate an accessor, why aren't we using it?" <<breakage>>
and the dot is useful for "this has an accessor/is public" documentation, regardless of where said accessor came from 18:09
timotimo the part about the constructor is the most important here 18:10
smls geekosaur: I don't understand the «why aren't we using it?" <<breakage>>» part.
If `$.foo` always tried to generate the accessor, no matter what, than the worst-case scenario would be a compiler error/warning if the method already exists, no? 18:11
araraloren smls, I agree with u. I hate the default behavior sometimes. Some terrible thing happen just because we miss something in document, I wonder are we using C ? 18:14
andreoss m: use MONKEY-TYPING; class Foo { our proto sub f($) {*} }; augment class Foo { multi sub f(1) { "one" } }; say Foo::f(10); 18:15
camelia Cannot resolve caller f(Int); Routine does not have any candidates. Is only the proto defined?
in block <unit> at <tmp> line 1
andreoss m: use MONKEY-TYPING; class Foo { our proto sub f($) {*} }; augment class Foo { our multi sub f(1) { "one" } }; Foo::f(10);
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use 'our' with individual multi candidates. Please declare an our-scoped proto instead
at <tmp>:1
------> 3class Foo { our multi sub f(1) { "one" }7⏏5 }; Foo::f(10);
expecting any of…
andreoss m: use MONKEY-TYPING; class Foo { proto method f($) {*}; multi method f(0) {"zero"}}; augment class Foo { multi method f(1) { "one" } }; say Foo.f(1); 18:17
camelia one
andreoss proto is shared for methods, but not for subs
geekosaur short form of what you already said? 18:33
ckraniak Is there a way to make an explicitly sized array in Native Call? 19:10
andreoss geekosaur: just wondering why 19:10
ckraniak Specifically, it will go in a struct and the struct has to be a certain size 19:11
timotimo ckraniak: sorry, we don't have support for that yet :(
ckraniak Ok, time to try a workaround 19:14
(famous last words)
timotimo github.com/timo/SDL2_raw-p6/blob/m...aw.pm#L106 ;_; 19:16
ckraniak Good to know that what I was fixing to do will work :D 19:25
Thanks
timotimo yw
ckraniak Now to automate it so I don't need to copy paste 128 of them 19:26
I looked into EXEC but it seems I can't define a class and then use it outside 19:27
timotimo you can, you just have to pass it on somehow and install it properly 19:28
timotimo m: use MONKEY-SEE-NO-EVAL; my \class = EVAL('class Omg { has $.foo; method lol { say "hi" } }'); class.new.lol 19:29
camelia hi
ckraniak Ooo 19:30
timotimo if you want to have something like "class Other is class" you'll have to do it at begin-time either with a BEGIN or by making it "constant class = ..." 19:31
ckraniak No lexical found with name $_ 19:35
timotimo where is that? 19:37
ckraniak This is if I uncomment the EVAL 19:40
timotimo i'd have to see more of the code in question 19:41
geekosaur ckraniakarray support is generally weak currently 19:42
er
ckraniak Might just write a file and import it
Then delete it
geekosaur ckraniak, array support is generally weak currently
mst "array support" ? 19:42
ohh. for Native Call
don't mind me, didn't read sufficient scrollback before placing foot in mouth 19:43
timotimo foot in mouth is basically how cats clean their paws 19:43
ugexe lowercase a means native as well
eater is there a reason why Supply doesn't have an `once` function? 19:47
ugexe what would you expect it to do?
eater return a promise which will resolve with the next item 19:48
or the first if it isn't a live supply
ugexe Supply.head ?
m: sub foo { once { say 100; } }; foo; foo; # once already exists
camelia 100
eater ah 19:49
eater ah 20:01
there is .one
ugexe i dont think that does what you want 20:04
eater not yet!
ugexe m: my $supplier = Supplier.new; my $supply = $supplier.Supply; $supply.head.tap(*.say); $supplier.emit(1); $supplier.emit(2) 20:06
camelia 1
eater m: sub one($supply) { my $p = Promise.new; my $v = $p.vow; $supply.head(1).tap(-> $d { $v.keep($d); }); return $p; }; say await one(Supply.from-list(0 .. 5));
camelia 0
eater idk if it's worth enough to put in Supply itself tho 20:08
ugexe you really want it to not print anything if your list is 0 .. Inf ?
eater ugexe: what do you mean?
ugexe m: say 1 ~~ Supply.from-list(^Inf).one 20:11
camelia (timeout) 20:12
eater oh! 20:13
ugexe m: my $supplier = Supplier.new; my $supply = $supplier.Supply; my $p = $supply.head.Promise; react { whenever $p { say "got it" }; $supplier.emit(1); $supplier.emit(2); }
camelia got it 20:13
eater so this is .head waiting for the Supply to complete I guess? 20:14
which seems odd behaviour imo
ugexe no 20:15
.head acts just like it does on lists
yoleaux ugexe: Sorry, that command (.head) crashed.
ugexe m: my $l = (^Inf).list; say $l.head # head isn't waiting for the "list" to complete 20:16
camelia 0
eater m: say await Supply.from-list(^Inf).head(1);
ugexe its not getting to .head 20:17
eater oh
camelia (timeout)
eater It's awaiting every statement?
m: my $s = Supply.from-list(^Inf); say await $s.head(1);
camelia (timeout)
eater or does the supply form head also close when it's parent closes?
s/form/from/ 20:18
ugexe its returns a Supply 20:20
you close suppliers and taps 20:22
eater when they're fullfilled, yea 20:23
ugexe i mean what do you mean by "supply form head also close"
eater well, maybe I'm wrong, but await Supply.from-list(^Inf).head(1) should work w/o timeout in what I'm currently seeing and thinking 20:25
from-list feeds .head, and head closes when it has 1 item
ugexe from-list is creating infinite elements
ugexe its not creating a lazy list that could be up to infinite 20:26
eater ah 20:27
yea
it's generating a supply which is infinite
ckraniak So CStruct can only take ~105 values? 20:31
ckraniak "CStruct can't perform boxed bind on flattened attributes yet" 20:32
Goes away if I delete a few attributes
ugexe m: my $supplier = Supplier.new; my $supply = $supplier.Supply; $supply.head.tap(*.say); (^Inf).map({ $supplier.emit($_); last if ++$ });
camelia 0
ugexe the last is only in there so it doesn't timeout after printing 0 20:33
timotimo ckraniak: that error supposedly happens when you try to assign a CStruct into an attribute that is defined "HAS blah $.other_thing" 20:35
andreoss is there a way to determine if a multi sub defined for a certain type of argument? 20:37
timotimo yeah, but i forgot which of the ones it is
jnthn andreoss: docs.perl6.org/routine/cando
timotimo that's the one!
user3 I want to define a named regex n that matches the text inside a single-quoted string without matching the single quotes. I tried this one which doesn't work: 20:39
m: my regex n { \'(<-[']>+)\' }; "'a bbb'" ~~ / (<n>) /; say "$0"
camelia 'a bbb'
ckraniak So far as I can tell it is only affected by the number of attributes in the definition of the class 20:40
timotimo you can use a lookbehind and lookahead assertion
jnthn m: my regex n { \'(<-[']>+)\' }; "'a bbb'" ~~ &n; say "$0"
camelia a bbb
jnthn (<n>) / wraps it in another level of match object
So you'd have to say $<n>[0] to get at the capture inside of n
user3 thx. i'll run a few tests 20:42
ugexe there is always <( 20:43
ckraniak More fun: error goes away if I define a second class exactly the same but with another name right after 20:48
And comes back of I comment out the original class and try to use the new one 20:49
*if
ugexe try just adding comments and see if it changes 20:56
ckraniak Ok this will be longwinded 20:57
ckraniak To get the CStruct class A to not complain about not being able to boxed bind 20:57
I can define a class B just before it, but it must have at least 41 uint16 attributes 20:58
I cannot comment out the attributes
If this were C I would suspect an undefined / uninitialized value somewhere 20:59
ugexe in the future all classes have exactly 41 uint16 attributes 21:01
ckraniak I am trying to write a struct for OsVersionInfoExW 21:02
ckraniak And expanding the WCHAR[128] to 128 uint16s 21:03
to get the memory layout correct
timotimo did you get something interesting by --ll-exception? 21:09
ckraniak timotimo: if you are asking me, I don't know what that means 21:12
timotimo it ought to give you a more complete stack trace for your error
ckraniak ok you mean command line parameter 21:13
--||- looks like it could be a perl operator
Oh that is two Ls 21:14
Woooow
timotimo yup
"low level" exception 21:15
i.e. don't cut out all lines that are in the core setting or the compiler
raschipi ckraniak: You need a better programming font. 21:17
eater oh 21:20
that --ll-exception helped :>
ckraniak IRC on phone 21:21
I don't have internet at home :\ 21:22
eater doh
temporarely?
ckraniak No forever. I would 100% waste all my time on World of Tanks if I had it
eater :( 21:23
ckraniak Much rather deal with this inconvenience than that one
ckraniak Well I know the trace goes through Mu BUILDALL but I already knew it throws on newing the class 21:27
timotimo mhm, right 21:28
ckraniak I don't see anything I could use 21:29
timotimo i don't see anything at all :P
eater timotimo: time to call a doctor then :o 21:30
timotimo hah 21:31
ckraniak Might just go to some Wi-Fi hotspot so I can pastebin this 21:33
andreoss ckraniak: you could install OpenBSD or something else that doesn't have games instead
raschipi m: my $i = (3.22)/500;my @a = 1,((* × (1 + $i)) + 1) ...∞; printf "{$++}: \$%.2f\n", 500 * @a[$_] - 50 for ^19 #Nice 21:35
camelia 0: $450.00
1: $953.22
2: $1459.68
3: $1969.40
4: $2482.41
5: $2998.72
6: $3518.35
7: $4041.33
8: $4567.68
9: $5097.42
10: $5630.57
11: $6167.15
12: $6707.19
13: $7250.70
14: $7797.72
15: $8348.26
16: $8902.34
17: $9460.0…
ckraniak andreoss: I have 4.8 dual boot on the other laptop, getting rid of Windows would help but the idea was to not have internet at all 21:44
Phone is a big in the reasoning, not an excuse
s/big/bug
[Coke] moritz: thanks for the headsup, whenevs. 21:53
[Coke] (I'm here now, so for me, now is awesome. :) 21:58
andreoss making type classes by augmenting doesn't seem to be a good way now 22:06
AlexDaniel ♥ Sets 22:31
timotimo sets rock 22:32
bags rocker
mixes rockest
AlexDaniel mixhash rockhashest? 22:34
timotimo mixhash rocks variably 22:35
AlexDaniel hmm should I use ∖ or (-) 22:35
timotimo honestly i prefer (-) because my font also suck 22:36
sucks
ckraniak pastebin.com/9KUUZM9R 22:37
ckraniak Whoops, s/New/new/ if you try to run that 22:40
timotimo i'm not sure if i can look into that before i go to sleep
AlexDaniel timotimo: fine :)
raschipi .tell masak In your 007 macro experiments, is it possible to get the parse tree macros get like one would use Perl6::Parse for (in Perl6 instead of 007)? I mean, since it has to be able to hand parse trees to macros, is there an interface that makes it possible to get the same when parsing a string? 22:45
yoleaux raschipi: I'll pass your message to masak.
andreoss raschipi: you might take a look at --backend=ast 22:52
raschipi I'm aware of that, thanks. 22:53
timotimo you can get the compiler and give it a :target argument 22:55
geekosaur rockest science? :p 22:56
raschipi timotimo: from inside Perl6? 22:57
timotimo yeah
m: use nqp; nqp::getcomp('Perl6').perl.say
camelia Cannot call method 'perl' on a null object
in block <unit> at <tmp> line 1
timotimo m: use nqp; nqp::getcomp('perl6').perl.say
camelia No such method 'perl' for invocant of type 'Perl6::Compiler'
in block <unit> at <tmp> line 1
timotimo m: use nqp; nqp::getcomp('perl6').eval("say 'whoa'", :target<ast>).dump.say 22:58
camelia - QAST::CompUnit :W<?> :UNIT<?>
[pre_deserialize]
- QAST::Stmt
- QAST::Stmt
- QAST::Op(loadbytecode)
- QAST::VM
[jvm]
- QAST::SVal(ModuleLoader.class)
[moar]
timotimo m: use nqp; nqp::getcomp('perl6').eval("say 'whoa'", :target<ast>).WHAT.say
camelia No such method 'say' for invocant of type 'QAST::CompUnit'
in block <unit> at <tmp> line 1
timotimo m: use nqp; nqp::getcomp('perl6').eval("say 'whoa'", :target<ast>).^name.say
camelia QAST::CompUnit
timotimo m: use nqp; nqp::getcomp('perl6').eval("say 'whoa'", :target<ast>).^methods.map(*.name).say
camelia (new sc hll load main compilation_mode pre_deserialize post_deserialize repo_conflict_resolver code_ref_blocks is_nested extra_children dump_children list unshift dump_node_list shift shallow_clone set_children pop push new set list node returns named fl…
timotimo how do you like this? :)
m: use nqp; nqp::getcomp('perl6').stages.perl.say 22:59
camelia ("start", "parse", "syntaxcheck", "ast", "optimize", "mast", "mbc", "moar")
timotimo ^- you can feed a qast (that you might have changed) directly to the optimize or mast stage
stages in the compiler are just methods with the same name 23:01
find more compiler stuff in nqp's repo under HLL/Compiler.nqp and rakudo's Perl6/Compiler.nqp
AlexDaniel eval :target<ast> :O 23:02
timotimo should also be able to pass :target to EVAL 23:03
raschipi Nice. What's Perl6::Parse for, then? 23:05
timotimo it makes things better i guess? 23:06
ugexe you can do all of that with Perl6::Parse if you know what you're doing 23:12
timotimo QAST is classes from nqp land and thus they aren't very perl6-friendly
like no .perl method
raschipi Any motive to keep nqp around instead of going for self-hosted? 23:15
timotimo performance is one
timotimo the more limited semantics nqp has allow for more aggressive optimization 23:15
for example, there's no scalar containers at all 23:16
raschipi Why not just introduce those types in Perl6 directly? 23:20
timotimo "those types"?
ugexe m: use Perl6::Grammar:from<NQP>; use Perl6::Actions:from<NQP>; my $*LINEPOSCACHE; my $source-code = q/use Test; my $x; $x++; say $x;/; my NQPMatch $tree = Perl6::Grammar.parse($source-code, :actions(Perl6::Actions.new())); say $tree.dump;
camelia - statementlist: use Test; my $x; $x++; say $x;
- statement: 4 matches
- statement_control: use Test
- doc:
- sym: use
- module_name: Test
- longname: Test
- name: Test
- identifier: …
jnthn The self-hosting nature of NQP certainly rears its head and makes development more costly now and then. It's manageable because relatively few of the changes happen there. 23:21
I'm glad all those working in Rakudo, myself included, don't have to deal with self-hosting there. 23:22
And anyone who thinks eliminating NQP would make bootstrapping issues vanish is waaaay to optimistic. We'd still have them, just somewhere else, and I suspect harder to debug. 23:23
That's presuming than a project to eliminate NQP even was successful in the first place. 23:24
Which, uh...well, that's a project I'd absolutely not wish to have on my plate.
*that a project 23:26
Spending the effort on getting macros and the QTree ideas from 007 into Rakudo would seem a far better use of effort. 23:27
timotimo looking forward to having that :) 23:30