»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend! Set by moritz on 22 December 2015. |
|||
00:01
mr-foobar left
00:03
BenGoldberg joined,
mcmillhj left
00:12
mcmillhj joined,
mr-foobar joined,
ckraniak joined
00:17
mcmillhj left
|
|||
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 | ||
00:25
dh7320 left
00:28
mcmillhj joined
00:30
mr-foobar left
00:32
mcmillhj left
00:35
mr-foobar joined
00:38
pierre_ joined
00:40
pierre_ left
00:41
mcmillhj joined
00:43
fbostanci left
00:45
mcmillhj left
|
|||
Geth | ecosystem: 2429b032f1 | (David Warring)++ | META.list add PDF::API6 - General purpose PDF librARY (WIP) |
00:49 | |
01:01
mr-foobar left
01:02
mr-foobar joined
|
|||
Geth | ecosystem: f88f36bfe1 | (David Warring)++ | META.list fix PDF::API6 url |
01:05 | |
01:06
tyil left
01:08
tyil joined
01:14
mcmillhj joined
01:18
mcmillhj left
01:19
Todd_ joined
|
|||
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}') | |||
01:31
mr-foobar left
01:32
mr-foobar joined,
mcmillhj joined
|
|||
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/..\/..\///' | |||
01:34
entonian joined
01:37
mcmillhj left,
entonian left
|
|||
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 |
||
01:46
ilbot3 left
|
|||
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 | |
01:48
mcmillhj joined
|
|||
Todd_ | would you show me the whole line? | 01:49 | |
01:51
ilbot3 joined,
ChanServ sets mode: +v ilbot3
01:54
Marks joined
01:55
mcmillhj left
|
|||
araraloren | ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).say for lines[1..*]' | 01:57 | |
01:59
Marks left
02:00
geekosaur left
|
|||
Todd_ | how do I get rid of the leading space? | 02:00 | |
02:08
noganex joined
02:09
mcmillhj joined,
cdg joined,
sufrosti1o left
02:10
sufrostico left
02:11
noganex_ left
02:13
zengargo1le left
02:14
mcmillhj left
|
|||
araraloren | Todd_, .trim | 02:22 | |
02:22
BenGoldberg left,
mcmillhj joined
02:24
BenGoldberg joined
|
|||
Todd_ | where do I put the trim? | 02:25 | |
araraloren | Hmm, before the result print | 02:27 | |
02:27
mcmillhj left
|
|||
Todd_ | ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).say for trim.lines[1..*]' | 02:29 | |
doesn't work | |||
02:29
mr-foobar left
|
|||
araraloren | ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).trim.say for lines[1..*]' | 02:30 | |
02:30
dubi0us joined
|
|||
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! | |||
02:31
mr-foobar joined
|
|||
Geth | doc: 72607fab64 | (Will "Coke" Coleda)++ | doc/Type/Iterable.pod6 remove trailing whitespace |
02:31 | |
02:37
mcmillhj joined
02:42
mcmillhj left
02:47
dubi0us_ joined
02:50
dubi0us left,
hythm_ joined
02:52
dubi0us_ left
02:53
mcmillhj joined
02:56
dubi0us joined
02:58
dubi0us_ joined
|
|||
raschipi | m: my $i = 3.2/500; my @a = 1,(* × (1 + $i))...∞; say 500 * @a[18] #Neat! | 02:58 | |
camelia | 560.843008310062 | ||
03:00
mcmillhj left
|
|||
ckraniak | FormatMessage now working, pointers confirmed for sucking in every language | 03:01 | |
03:01
dubi0us left
|
|||
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 | |
03:09
dubi0us_ left
|
|||
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 | |
03:11
mcmillhj joined
|
|||
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 | ||
03:14
dubi0us joined
03:16
Cabanossi left
03:17
Cabanossi joined
|
|||
ckraniak | I like Perl 6 in general a lot though | 03:17 | |
03:18
mcmillhj left,
dubi0us left,
dubi0us joined
|
|||
BenGoldberg | ckraniak, You don't have to pass, say, Pointer[void] specificially -- you could just pass in Pointer. | 03:21 | |
03:22
dubi0us left
|
|||
araraloren | you can replace CArray[uin8] with buf16 | 03:28 | |
03:28
dubi0us joined
03:30
mcmillhj joined
03:34
mcmillhj left
03:36
brabo left
03:38
dubi0us left
03:40
wamba joined
03:41
dubi0us joined
|
|||
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 | ||
03:53
pharv_ joined
|
|||
araraloren | ckraniak, what are trying to do ? | 04:00 | |
ckraniak | WinAPI garbage. Hit of a language learning exercise | 04:01 | |
04:01
geekosaur joined
|
|||
ckraniak | s/hit/bit/ | 04:01 | |
04:02
mcmillhj joined,
mr-foobar left
|
|||
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 | |
04:03
mr-foobar joined
|
|||
araraloren | yeah, should do some dig use NativeCall before write real code | 04:04 | |
04:05
wamba left,
pharv_ left
04:08
mcmillhj left
04:09
ruoso_ left
04:11
wamba joined,
cdg left
04:15
hythm_ left
04:17
mcmillhj joined
04:18
itaylor57 left
04:21
mcmillhj left
04:23
mcsnolte left,
raschipi left
04:37
mcmillhj joined
04:42
mcmillhj left
04:43
BenGoldberg left
04:46
Cabanossi left
04:47
Cabanossi joined
04:49
dubi0us left
04:50
mcmillhj joined
04:52
dubi0us joined
04:54
dubi0us_ joined
04:55
mcmillhj left
04:57
dubi0us left
05:00
pelev left,
lucs left
05:03
skids left
05:06
wigner joined
05:10
Todd_ left
05:11
khw left
05:21
mcmillhj joined
05:26
mcmillhj left
05:38
llfourn_ joined
05:46
pierre_ joined,
mcmillhj joined
05:48
wigner left
05:51
mcmillhj left
05:54
haha_ joined
06:01
mr-foobar left
06:04
mr-foobar joined
06:05
mcmillhj joined,
dubi0us_ left
06:09
dubi0us joined
06:10
mcmillhj left
06:13
dubi0us left
06:18
mcmillhj joined
06:20
pharv joined,
aborazmeh joined,
aborazmeh left,
aborazmeh joined
06:23
mcmillhj left
06:25
wamba left
06:26
dubi0us joined
06:27
coetry joined
|
|||
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 | ||
06:30
dubi0us left
06:32
Voldenet left
06:36
mcmillhj joined
06:40
mcmillhj left
06:49
dubi0us joined
06:53
dubi0us left
06:58
haha_ left
07:00
Cabanossi left
07:02
Cabanossi joined
07:04
ijneb left
07:05
mcmillhj joined
07:10
ChoHag joined
07:11
nadim joined
07:12
mcmillhj left
07:13
lisbeth joined,
lisbeth is now known as lisbeths,
lisbeths left
07:21
pharv left
07:22
pharv_ joined
07:25
coetry left,
eroux left
07:28
raschipi joined
07:29
darutoko joined,
pierre_ left
07:30
raschipi left
07:31
imcsk8 left,
imcsk8 joined
07:33
renormalist joined
|
|||
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 | |
07:35
imcsk8 left
|
|||
gfldex | renormalist: github.com/drforr/perl6-Perl6-Parser | 07:36 | |
07:36
mcmillhj joined
07:37
imcsk8 joined
|
|||
renormalist | gfldex: thanks! | 07:37 | |
07:38
pierre_ joined,
aborazmeh left
07:41
lizmat left
07:44
mcmillhj left
07:49
dubi0us joined
07:53
dubi0us left
07:55
dubi0us joined
07:57
pmurias joined
|
|||
pmurias is back home after TPC::EU | 07:57 | ||
07:58
mcmillhj joined,
pierre_ left
07:59
dubi0us left
08:00
Cabanossi left
08:02
mr-foobar left,
Cabanossi joined
08:03
mcmillhj left
08:04
mr-foobar joined
08:08
pierre_ joined
08:10
dubi0us joined,
mcmillhj joined
08:14
dubi0us left
08:15
mcmillhj left
|
|||
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 | |
08:16
dubi0us joined
08:17
pharv_ left
08:20
dubi0us left
08:21
Voldenet joined,
Voldenet left,
Voldenet joined
|
|||
Geth | Inline-Perl5: b92d7b1ce4 | (Stefan Seifert)++ | 2 files Version 0.29 |
08:22 | |
08:24
pierre_ left
08:26
mcmillhj joined
08:27
dubi0us joined
08:29
pierre_ joined
08:31
dubi0us left
08:32
mcmillhj left,
pilne left,
mr-foobar left
08:33
mr-foobar joined
08:34
mcmillhj joined
08:35
zengargoyle joined
08:39
mcmillhj left
08:44
andrzejku joined,
lisbeths joined
08:45
Cabanossi left,
andrzejku left
|
|||
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 | ||
08:47
Cabanossi joined,
andrzejku joined
|
|||
pmurias | is there stuff that's discouraging people from contributing to the Perl 6 docs? | 08:48 | |
lisbeths | Probably not | ||
08:48
llfourn_ left
08:52
dubi0us joined
|
|||
moritz | lisbeths: please show some example code. run() is supposed to work | 08:52 | |
08:56
dubi0us left
08:58
dubi0us joined
|
|||
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 | |||
09:07
dubi0us left
|
|||
moritz | $str.split(' ', 2) | 09:12 | |
09:15
dwarring left
09:19
ChoHag left,
dubi0us joined
09:21
andrzejku left
09:22
andrzejku joined
09:23
avalenn left
09:24
dubi0us left,
haha_ joined,
lizmat joined
09:26
pierre_ left
09:31
Cabanossi left
09:32
mr-foobar left,
zengargoyle left,
mr-fooba_ joined,
Cabanossi joined
09:34
zengargoyle joined
|
|||
pmurias | Why do I get an exception 'This types (Scalar) does not support positional operations' without a backtrace? | 09:38 | |
09:38
hankache joined
|
|||
pmurias | it's optimizer complaining of Scalars getting mixed up into QAST because of NQP crappiness | 09:46 | |
09:48
rindolf joined
|
|||
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 | ||
10:01
dubi0us joined
10:02
Cabanossi left,
Cabanossi joined
10:05
ijneb joined
10:06
sena_kun joined
10:10
dubi0us left
10:12
dubi0us joined
10:13
dubi0us left
10:27
dubi0us joined
10:31
HoloIRCUser1 joined,
dubi0us left
10:32
HoloIRCUser1 is now known as LanceW,
lisbeths` joined
10:35
pierre_ joined
10:36
dubi0us joined,
yati joined,
lisbeths left
10:37
sena_kun left
|
|||
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 | ||
10:40
dubi0us left
10:45
dubi0us joined
|
|||
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 | |
10:50
dubi0us left
|
|||
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 | |
10:55
dubi0us joined
|
|||
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 | ||
10:56
TEttinger left
|
|||
pmurias | renormalist: yes | 10:57 | |
10:58
pierre_ left
10:59
dubi0us left,
setty1 joined
11:04
dubi0us joined,
setty1 left
11:05
setty1 joined,
pierre_ joined
11:06
Aaronepower left,
Aaronepower joined
11:08
dubi0us left
11:10
BenGoldberg joined
11:11
Aaronepower left
|
|||
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 | |||
11:15
dubi0us joined
11:18
pierre_ left
11:19
dubi0us left
|
|||
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 | |
11:36
HoloIRCUser2 joined
11:38
LanceW left
11:39
pierre_ joined
|
|||
El_Che | stmuk: and grammars | 11:41 | |
11:44
Cabanossi left
11:45
HoloIRCUser4 joined
11:47
Cabanossi joined
11:48
dubi0us joined
11:49
HoloIRCUser2 left
11:53
dubi0us left
|
|||
moritz | really? | 11:55 | |
ryu0 | wouldn't surprise me. some P6 features are getting backports to P5 in some way. | ||
11:56
evanm joined,
coetry joined
|
|||
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 | ||
11:58
dubi0us joined
|
|||
evanm | Does anyone know what this error means? "No such method 'cache' for invocant of type 'NQPMu'" | 11:59 | |
12:02
gdonald left
|
|||
evanm | It's happens during a call to "await", but I have no idea what it's talking about | 12:02 | |
12:02
dubi0us left
|
|||
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 | ||
12:08
dubi0us joined,
gdonald joined
|
|||
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 | |||
) | |||
12:12
dubi0us left
|
|||
lizmat | tyil: sorry, missed it: | 12:12 | |
seems damnlie is going to TechInc, but have no ETA for that | 12:13 | ||
12:13
andreoss joined,
lizmat left
|
|||
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 | ||
12:17
dubi0us joined
|
|||
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 | ||
12:22
dubi0us left
|
|||
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 | ||
12:24
feng joined
12:25
mr-foobar joined
|
|||
moritz | I have plans for a new personal website for myself; this looks like a good candidate | 12:25 | |
12:27
mr-fooba_ left
|
|||
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 | |
12:28
dubi0us joined
|
|||
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 | ||
12:31
Cabanossi left
12:32
Cabanossi joined,
dubi0us left
|
|||
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 |
||
12:34
BenGoldberg left
|
|||
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 | ||
12:39
dubi0us joined
|
|||
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 |
||
12:40
xinming left
12:41
hankache_ joined
|
|||
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 | |||
12:43
dubi0us left
|
|||
ryu0 | m: role Bar {...}; role Foo { method abs {...} }; | 12:43 | |
camelia | ( no output ) | ||
12:43
hankache left
|
|||
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 | ||
12:55
dubi0us joined
|
|||
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 | ||
13:00
dubi0us left,
HoloIRCUser6 joined
13:01
HTTP_____GK1wmSU joined
13:02
HoloIRCUser4 left
|
|||
pmurias | wow, modules.perl6.org looks good now | 13:03 | |
tremendous upgrade from looking like shit :) | |||
13:04
HTTP_____GK1wmSU left
|
|||
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 | ||
13:11
hankache_ left
|
|||
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 | |
13:13
lucs joined
|
|||
araraloren | have you read perl6 introduction perl6intro.com/ ? | 13:14 | |
13:14
nadim left
|
|||
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 | ||
13:32
dubi0us joined
|
|||
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 | ||
13:37
dubi0us left
|
|||
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 | |
13:45
HoloIRCUser1 joined
13:48
dubi0us joined
13:50
HoloIRCUser6 left
|
|||
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 | ||
13:52
hankache_ joined,
dubi0us left
13:58
hankache_ left
14:01
Cabanossi left
14:02
Cabanossi joined,
feng left
14:08
HoloIRCUser4 joined
14:10
HoloIRCUser7 joined
14:11
HoloIRCUser1 left
14:13
HoloIRCUser4 left,
evanm left
14:22
coetry left
14:25
dubi0us joined
|
|||
andreoss | m: (Array[Int]).WHAT.say; | 14:33 | |
camelia | (Array[Int]) | ||
andreoss | how can i get Int from it? | ||
14:36
pierre_ left
|
|||
timotimo | m: say Array[Int].of.perl | 14:38 | |
camelia | Int | ||
14:38
dubi0us left
14:42
HoloIRCUser1 joined
14:44
HoloIRCUser7 left
14:45
Cabanossi left
14:47
haha_ left,
Cabanossi joined
14:50
HoloIRCUser joined,
haha_ joined
14:53
HoloIRCUser1 left
14:57
setty1 left
14:58
HoloIRCUser1 joined
15:00
HoloIRCUser left
15:01
evanm joined
15:07
cdg joined
|
|||
andreoss | timotimo: what about general case? | 15:13 | |
15:14
khw joined
|
|||
timotimo | hmm good question | 15:15 | |
might have to rely on the role itself to expose its parameters to users | 15:16 | ||
15:18
mr-fooba_ joined
|
|||
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 | |||
15:20
mr-foobar left
|
|||
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 | |||
15:31
wamba joined,
Cabanossi left
15:32
Cabanossi joined
|
|||
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 | |||
15:36
pierre_ joined
15:41
pierre_ left,
evanm left
15:48
evanm joined
16:01
Cabanossi left
16:02
Cabanossi joined
16:04
HoloIRCUser joined,
HoloIRCUser6 joined
16:05
nadim joined
16:06
HoloIRCUser1 left
16:08
HoloIRCUser left
|
|||
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… |
||
16:13
zengargoyle left
|
|||
timotimo | i didn't know you could re-open a package just like that | 16:14 | |
andreoss | are packages file-scoped? | ||
16:15
dubi0us joined
|
|||
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 | ||
16:19
pilne joined,
Resol left
|
|||
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 |
||
16:22
itaylor57 joined
16:23
itaylor57 left
16:24
dubi0us left
16:25
itaylor57 joined
16:30
dubi0us joined,
zengargoyle joined
16:34
dubi0us left
|
|||
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. | ||
16:37
Matthew[m] left
|
|||
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) ...` | ||
16:37
M-Illandan left,
mienaikage left,
ilmari[m] left,
tyil[m] left,
mack[m] left,
tadzik left,
Aaronepower joined
|
|||
timotimo | well, all of rakudo uses it like Thing.archetypes.something | 16:37 | |
16:37
CIAvash[m] left,
wictory[m] left,
xui_nya[m] left
|
|||
timotimo | or rather Thing.HOW.archetypes.something | 16:38 | |
16:38
unclechu left
|
|||
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 |
||
16:40
dubi0us joined
16:41
evanm left
|
|||
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 | ||
16:42
pharv_ joined
|
|||
araraloren AFK a little too | 16:42 | ||
andreoss | araraloren: this doesn't work across files though | 16:45 | |
16:45
BenGoldberg joined,
Cabanossi left
16:47
Cabanossi joined
16:49
dubi0us left
16:52
haha_ left
16:54
dubi0us joined
|
|||
araraloren | andreoss, yeah, that's what I mean above | 16:58 | |
16:59
dubi0us left
17:06
zengargoyle left
17:07
dubi0us joined
17:09
smls joined
|
|||
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! | ||
17:11
dubi0us left
|
|||
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 | |
17:11
dubi0us joined
17:12
HoloIRCUser2 joined
|
|||
moritz | yes | 17:13 | |
the role composition comes first | |||
17:13
HoloIRCUser6 left
|
|||
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 | ||
17:16
pharv_ left
|
|||
moritz | I think re-exporting is not yet implemented | 17:16 | |
17:17
dubi0us left
|
|||
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 | ||
17:21
MasterDuke_ joined,
MasterDuke left
17:24
xinming joined
17:25
MasterDuke_ left
17:26
MasterDuke joined
17:27
rindolf left
|
|||
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 | |
17:33
cdg left
17:35
HoloIRCUser2 left
|
|||
araraloren | and I think one common reason is you can use named argument in default constructor | 17:36 | |
17:36
dubi0us joined
17:37
Guest69863 joined
|
|||
araraloren | $!foo mean private attribute, and you need provide BUILD if you want set foo with named argument | 17:38 | |
17:41
dubi0us left
|
|||
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 | ||
17:44
rindolf joined
17:45
Cabanossi left
17:46
dubi0us joined
17:47
Cabanossi joined
17:49
MasterDuke left
17:50
MasterDuke joined,
dubi0us left
|
|||
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 | |
17:53
tadzik joined
17:55
dubi0us joined
17:59
dubi0us left
|
|||
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 | |
17:59
tyil[m] joined,
wictory[m] joined,
unclechu joined,
M-Illandan joined,
mack[m] joined,
ilmari[m] joined,
Matthew[m] joined,
d4l3k_ joined,
ChanServ sets mode: +v d4l3k_
18:00
xui_nya[m] joined,
mienaikage joined,
CIAvash[m] joined
|
|||
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 | |
18:01
Guest69863 left
|
|||
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 | |
18:01
camelia left,
dalek left
18:02
d4l3k_ is now known as dalek
|
|||
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 | |
18:06
camelia joined,
dubi0us joined
18:07
ChanServ sets mode: +v camelia
|
|||
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 | ||
18:11
dubi0us left
|
|||
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 | ||
18:21
pochi left
|
|||
geekosaur | short form of what you already said? | 18:33 | |
18:38
Sgeo left,
haha_ joined
18:44
raschipi joined
19:08
yqt joined
19:09
lisbeths` left
|
|||
ckraniak | Is there a way to make an explicitly sized array in Native Call? | 19:10 | |
19:10
D33P-B00K joined
|
|||
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 :( | ||
19:12
D33P-B00K left
19:14
darutoko left,
wamba left
|
|||
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 | |
19:28
TEttinger joined
|
|||
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 | ||
19:42
nadim left
|
|||
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 | ||
19:43
nadim joined
|
|||
timotimo | foot in mouth is basically how cats clean their paws | 19:43 | |
ugexe | lowercase a means native as well | ||
19:46
haha_ left
|
|||
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 | |
19:50
dubi0us joined
19:53
dubi0us_ joined
19:56
BenGoldberg left
19:57
dubi0us left,
dubi0us_ left
20:00
Cabanossi left
20:01
dubi0us joined
|
|||
eater | ah | 20:01 | |
there is .one | |||
20:02
Cabanossi joined
|
|||
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? | ||
20:08
dubi0us left
|
|||
ugexe | m: say 1 ~~ Supply.from-list(^Inf).one | 20:11 | |
camelia | (timeout) | 20:12 | |
20:12
Sgeo joined
|
|||
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); } | ||
20:13
andrzejku left
|
|||
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. | ||
20:16
dubi0us joined
|
|||
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 | ||
20:19
tokomer joined
|
|||
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 | ||
20:26
Sgeo_ joined
|
|||
ugexe | its not creating a lazy list that could be up to infinite | 20:26 | |
20:27
Sgeo left
|
|||
eater | ah | 20:27 | |
yea | |||
it's generating a supply which is infinite | |||
20:29
coetry joined,
dubi0us left
20:30
pharv_ joined
20:31
coetry left
|
|||
ckraniak | So CStruct can only take ~105 values? | 20:31 | |
20:31
dubi0us joined
|
|||
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 | |
20:36
user3 joined
|
|||
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! | ||
20:38
cdg joined
|
|||
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 | |
20:43
yqt left
20:44
dubi0us left
20:45
konsolebox left,
Sgeo__ joined
20:47
Sgeo_ left
|
|||
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 | |||
20:50
konsolebox joined
20:51
cdg left
20:55
dubi0us joined
|
|||
ugexe | try just adding comments and see if it changes | 20:56 | |
ckraniak | Ok this will be longwinded | 20:57 | |
20:57
smls left
|
|||
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 | ||
20:59
Guest69863 joined
21:00
Cabanossi left,
zakharyas joined
|
|||
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 | |
21:02
Cabanossi joined
21:03
tokomer left
|
|||
ckraniak | And expanding the WCHAR[128] to 128 uint16s | 21:03 | |
to get the memory layout correct | |||
21:03
zengargoyle joined
21:05
dubi0us left
21:09
rindolf left
|
|||
timotimo | did you get something interesting by --ll-exception? | 21:09 | |
21:09
MasterDuke left
21:11
dubi0us joined
|
|||
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 | |||
21:16
pmurias left
|
|||
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 | ||
21:23
Guest69863 left
|
|||
eater | :( | 21:23 | |
ckraniak | Much rather deal with this inconvenience than that one | ||
21:25
dubi0us left
|
|||
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 | |
21:32
Cabanossi left,
Cabanossi joined
|
|||
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 | ||
21:33
dubi0us joined,
emeric joined
|
|||
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… |
||
21:38
dubi0us left
21:41
setty1 joined
21:42
pharv_ left,
dubi0us joined
21:43
lizmat joined
|
|||
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 | |||
21:53
konsolebox left
|
|||
[Coke] | moritz: thanks for the headsup, whenevs. | 21:53 | |
21:56
zengargoyle left
21:58
pharv_ joined
|
|||
[Coke] | (I'm here now, so for me, now is awesome. :) | 21:58 | |
21:59
Hotkeys joined
22:06
dubi0us left
|
|||
andreoss | making type classes by augmenting doesn't seem to be a good way now | 22:06 | |
22:07
zengargoyle joined
22:08
zengargoyle left,
zengargoyle joined,
zakharyas left,
yati left
22:11
dubi0us joined
22:12
zengargoyle left
22:15
dubi0us left
22:21
dubi0us joined
22:23
zengargoyle joined
22:24
nadim left
22:26
dubi0us left
22:30
dubi0us joined
|
|||
AlexDaniel ♥ Sets | 22:31 | ||
timotimo | sets rock | 22:32 | |
bags rocker | |||
mixes rockest | |||
AlexDaniel | mixhash rockhashest? | 22:34 | |
timotimo | mixhash rocks variably | 22:35 | |
22:35
zengargoyle left,
dubi0us left
|
|||
AlexDaniel | hmm should I use ∖ or (-) | 22:35 | |
22:36
setty1 left,
zengargoyle joined
|
|||
timotimo | honestly i prefer (-) because my font also suck | 22:36 | |
sucks | |||
22:37
tadzik left
|
|||
ckraniak | pastebin.com/9KUUZM9R | 22:37 | |
22:38
xui_nya[m] left,
M-Illandan left,
ilmari[m] left,
tyil[m] left,
mack[m] left,
Matthew[m] left,
mienaikage left,
imcsk8_ joined,
CIAvash[m] left,
unclechu left
|
|||
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 :) | ||
22:41
ilbot3 left,
dubi0us joined
22:42
imcsk8 left,
BenGoldberg joined
22:43
wictory[m] left
22:44
MasterDuke joined
|
|||
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. | ||
22:45
dubi0us left
22:47
ilbot3 joined,
ChanServ sets mode: +v ilbot3
|
|||
andreoss | raschipi: you might take a look at --backend=ast | 22:52 | |
raschipi | I'm aware of that, thanks. | 22:53 | |
22:55
dubi0us joined
|
|||
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 | |||
23:02
zengargoyle left
|
|||
AlexDaniel | eval :target<ast> :O | 23:02 | |
23:02
lizmat left,
dubi0us_ joined
23:03
dubi0us left,
zengargoyle joined
|
|||
timotimo | should also be able to pass :target to EVAL | 23:03 | |
23:04
sivoais left,
user3 left
|
|||
raschipi | Nice. What's Perl6::Parse for, then? | 23:05 | |
timotimo | it makes things better i guess? | 23:06 | |
23:07
dubi0us_ left
23:11
lizmat joined,
dubi0us joined,
sivoais joined
|
|||
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 | ||
23:15
dubi0us left
|
|||
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: … |
||
23:21
dubi0us joined
|
|||
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 | ||
23:30
Cabanossi left
|
|||
timotimo | looking forward to having that :) | 23:30 | |
23:30
dubi0us left
23:32
Cabanossi joined
23:33
dubi0us joined
23:38
pharv_ left,
dubi0us left
23:41
dubi0us joined
23:42
zengargoyle left
23:46
dubi0us left
23:50
tadzik joined,
dubi0us joined
23:54
dubi0us left
23:56
tyil[m] joined,
unclechu joined,
mack[m] joined,
wictory[m] joined,
M-Illandan joined,
Matthew[m] joined,
xui_nya[m] joined,
ilmari[m] joined,
mienaikage joined,
CIAvash[m] joined
|