pugscode.org/ | nopaste: sial.org/pbot/perl6 | pugs: [~] <m oo se> (or rakudo:, kp6:, elf: etc.) (or perl6: for all) | irclog: irc.pugscode.org/ Set by Tene on 29 July 2008. |
|||
00:01
bacek__ joined
|
|||
masak | what's the best-looking way to emulate for @array.kv -> $ix, $elem { ... } in Perl 5? | 00:04 | |
00:05
Jedai joined,
bacek joined,
bacek_ left
00:07
bacek__ is now known as bacek_
|
|||
bacek_ | masak: my @array; my $kv = sub { my @s = @array; my $index = 0; my @res; push @res, $index++; push @res, shift @array; @res }; while(my ($k,$v) = $kv->()) { ...} | 00:10 | |
masak | bacek_: aye. | 00:11 | |
that works. | |||
Limbic_Region | masak - with or without modules? | ||
masak | Limbic_Region: give me all you've got. :) | ||
bacek_ | masak: probably. I wrote it without checking :) | ||
Limbic_Region | I think mapcar from Algorithm Loops does what you want more naturally | 00:12 | |
combine that with n_at_a_time from List::MoreUtils and you are done | |||
oh wait | |||
List::MoreUtils has zip and natatime | 00:13 | ||
masak | Limbic_Region++ | ||
I should learn List::MoreUtils better | |||
Limbic_Region | my $it = natatime(2, zip @keys, @vals); while (my $k, $val = $it->()) { ... } # something like that | 00:16 | |
masak | natatime :) I like. | ||
bacek_ | natatime(2, zip 0..$#array, @array) | ||
Limbic_Region rolls his own iterators so is not overly familiar with List::MoreUtils other than a good memory for where such functions might be found | 00:18 | ||
mapcar from Algorithm::Loops is far more powerful btw than List::Util's zip but you just need the simple zip anyway | 00:19 | ||
masak | mm | 00:22 | |
IƤll look into Algo::Loops as well. | |||
s/Ƥ/'/ # juggling keyboard layouts | |||
00:24
mtrimpe joined
|
|||
Limbic_Region | that was more FYI than anything else - it is unnecessary for this task | 00:25 | |
but if you are interested in arbitrarily nested loops - Algorithm::Loops freaking rawks | |||
and you might be interested in an article I wrote about it - perlmonks.org/?node=arbitrarily+nested+loops | 00:26 | ||
lambdabot | Title: Arbitrarily Nested Loops | ||
00:26
cognominal joined
|
|||
masak | I am. thank you. | 00:28 | |
00:34
jhorwitz left
00:40
mtrimpe left
|
|||
masak | I like what Mark J. Reed is saying in the thread 'sign() always returns 1 when $x ~~ Complex'. (he's saying that sqrt(-1) should return i, because that'd be DWIMmiest.) is there a way to make complex functions DWIM and still retain some kind of type system sanity? | 00:48 | |
Limbic_Region | masak - I am pretty sure there is a complex number module on CPAN for perl 5. Not sure what you are trying to accomplish but I don't think returning a literal 'i' is the right thing | 00:50 | |
masak | I'm back at talking about the design of Perl 6. | ||
Limbic_Region | returning a complex number object that happens to have the value of i is better IMO | ||
ah | |||
masak | just thinking about what would be a good combination of user-nice and type-nice | 00:51 | |
Limbic_Region | well, unless the type system supports complex numbers natively than sqrt(-1) should throw an exception or return undef but not 'i' | ||
masak | the type system does support complex numbers natively. | ||
RTFS :) | 00:52 | ||
Limbic_Region stopped keeping up with the Ss when audreyt had to take her sabattical and pugs when stagnant | |||
I am lucky to follow #perl6 and #parrot more than twice a week | |||
masak | Limbic_Region: you're not at all enthused by Rakudo? | 00:53 | |
(I am.) | |||
Limbic_Region | oh, very much so | 00:54 | |
but in the interim, I has a 2nd daughter | |||
and a promotion (more responsibility) | 00:55 | ||
my wife is learning to drive and applying for her citizenship | |||
etc, etc, etc | |||
masak | OIC | ||
Limbic_Region | you know the saying - you need to pick your battles | ||
in my case, you need to pick your time syncs | 00:56 | ||
sinks | |||
masak | aye | ||
speaking of time sinks, time to go home and sleep | |||
Limbic_Region | I still build parrot and rakudo regularly since there aren't many Win32/MinGW or Win32/Cygwin folks | ||
sleep well | |||
masak | thank you | ||
see you around! | |||
00:56
masak left
00:57
mbtrimpe joined
01:02
slavik joined
|
|||
slavik | for rakudo, where can I setup the defaul library path? | 01:02 | |
Limbic_Region | slavik - best to ask on #parrot on irc.perl.org | ||
though a lot of folks hang out in both places | 01:03 | ||
jnthn | slavik: PERL6LIB | ||
(Environment variable) | |||
IIRC | |||
jnthn wonders if slavik is Slavic. :-) | 01:04 | ||
slavik | jnthn: yes and is there a config for it or some such? | 01:05 | |
01:06
mbtrimpe left
|
|||
jnthn | slavik: As in, a command line option, or some default config file we load it from? | 01:06 | |
slavik | the latter | ||
also, where can I read about adding binds to a C module into Perl6? | |||
bindings* | 01:07 | ||
or does rakudo have to be built with bindings? | |||
jnthn | slavik: Looking at the code at the moment, we don't load any default yet. | 01:08 | |
Or that's how it looks to me... | |||
slavik | so PERL6LIB? | 01:09 | |
jnthn | Yes, just set that | ||
slavik | k | ||
jnthn | Separate paths with : | ||
On bindings | |||
slavik | same as all other PATH/LIB vars | ||
heh | |||
jnthn | We don't have a way to directly do this from Perl 6 yet. | ||
slavik | p00p | ||
jnthn | However, you don't need to compile them in or write any C either. | ||
slavik | err? | 01:10 | |
jnthn | You can write them in PIR, or at lesat some thin layer. | ||
slavik | where can I read about that? | ||
jnthn | And then call those from Perl 6 code. | ||
Limbic_Region | PIR = parrot intermediate representation | ||
slavik | I should prolly look at the OpenGL pir code, right? | ||
Limbic_Region | it is one step above PASM = Parrot assembly language | ||
jnthn | slavik: Yes, that is exactly what I was going to point you to. :-) | ||
Limbic_Region | but don't let that scare you - it is pretty easy to read | 01:11 | |
jnthn | That is known to be usable from Perl 6 too. | ||
slavik | hmm | ||
is PIR to PASM like C is to ASM? | |||
jnthn | See for more on NCI examples/nci in Parrot | ||
slavik | or am I off? | ||
jnthn | PIR is an intermediate language, a bit like the .Net CLR's IL | 01:12 | |
slavik | haven't seen that either | ||
01:13
IRSeekBot joined
|
|||
jnthn | It is a bit higher level than the assembly. You don't have to worry about register allocation. You can write function calls quite easily, and it generates the several instructions that are actually needed to make the call. | 01:13 | |
So it's a tad more pleasant than assembly. | |||
I hope that we'll find a way soonish to be able to do NCI directly from Perl 6. | |||
slavik | hmm | 01:16 | |
pir doesn't look all that pleasent ... looks like it is stack based or something | |||
set arguments, then call function | |||
jnthn | slavik: No, it's register based. | ||
slavik: You don't need to write a lot of it to make a basic interface around a C library that you can then call from Perl 6. | 01:17 | ||
slavik | .begin_call .set_arg 1 ,set_arg 2 .nci_call funcname .end_call | ||
jnthn | eww | ||
Yes, OK, there is *that* syntax. :-) | |||
slavik | jnthn: that's what I see in an sdl pir example | ||
jnthn: is there a write up? | |||
like a how to or something? | 01:18 | ||
jnthn | Yeah, see e.g. win32api.pir for something nicer | ||
slavik | loadlib does the dynamic loading? | ||
jnthn | Yes | ||
slavik | hmm, I think pir so far looks way better than XS ;) | ||
jnthn | dlfunc looks up a symbol | ||
there is www.parrotcode.org/docs/pdd/pdd16_n..._call.html | |||
lambdabot | Title: NCI conventions and definitions - parrotcode | ||
jnthn | Yes, you don't have to write any C. ;-) | 01:19 | |
slavik | I don't mind C ... | ||
I like C, but not for text processing ;) | |||
01:19
thestarslookdown joined
|
|||
jnthn | Oh, I don't mind writing C. But when it comes to wanting to ship bindings, not requiring the end user to have a C compiler to install it is nice. | 01:19 | |
slavik | hmm, would it be possible to generate a pir given a .so file | 01:20 | |
jnthn | Not from that, but I think from a .h file there is a tool | ||
slavik | jnthn: I am of the opinion that linux without a C compiler is like a car on 3 wheels ... doable, but why? | ||
jnthn: by tool, you mean Perl6? :P | |||
01:21
km3 left
|
|||
jnthn | I think it actually parses the headers using a Perl 6 grammar... ;-) | 01:21 | |
slavik | figures | ||
jnthn | I honestly don't know much about it, I'm afraid - ask in #parrot, especially tewk... | ||
slavik | Perl6 building Perl6 bindings ... kind of scary | ||
jnthn | It's fairly new, and I didn't play with it just yet. | ||
slavik | what if it becomes self-sentient or something | ||
jnthn | We sit and pray for a segfault. | 01:22 | |
:-) | |||
slavik | jnthn: I had an idea to have a header which included all other headers in the library and then pipe it through the CPP to get a nice flat file and process that | ||
jnthn: ^^ | |||
jnthn | Cunning trick! | 01:23 | |
:-) | |||
slavik | jnthn: so, pir can be thought of as describing to parrot what the functions are? | ||
jnthn | Yes, pretty much. | ||
slavik | because by that extent, you could have parrot load ANY library without any bindings | ||
it could then process the .h if available and bam, done | 01:24 | ||
jnthn | That's the dream. :-) | ||
slavik | also, what about types and such? they are converted automatically? | ||
because Perl5 bindings have glVertex() no glVertex2f() and the others | |||
jnthn | I believe that the type conversions are handled, yes. | 01:25 | |
01:27
sri_kraih_ left
|
|||
slavik | what if I want to combine multiple versions of the same basic function that have different number of arguments? | 01:31 | |
do I have to rely on some default/generic value? | |||
jnthn | Where do you mean? When writing PIR? | 01:32 | |
You can use :optional | |||
To mark a parameter as optional | |||
And you can also declare multi subs | |||
01:34
km2 joined
|
|||
jnthn -> sleep | 01:35 | ||
slavik | ty, night | 01:39 | |
02:04
thestarslookdown left
|
|||
pugs_svn | r23069 | lwall++ | [gimme5] make sure STD.pmc ends with 1; | 02:04 | |
r23069 | lwall++ | [STD] add substr to list of recognized methods following .= | |||
02:04
[particle]1 left
02:06
spx2 left,
spx2 joined
02:12
stephens left
|
|||
TimToady | though arguably, substr produces strings, which might be indicative of an attempt to do concatenation, but the test suite uses $x .= substr($pos) | 02:13 | |
slavik | TimToady: has anyone measured the overhead of calling C libraries from rakudo? | 02:15 | |
wayland76 | slavik: The script for generating C bindings is called nci_gen.pl | 02:16 | |
slavik | wayland76: ty | ||
wayland76: it's not a fool proof method, though, is it? | |||
wayland76 | At the moment, it may not be, but I believe they're intending it to be | 02:17 | |
slavik | k | ||
wayland76 | I looked at it once, but it was broken when I tried it and, though it's fixed now, I never got back to it :) | ||
parrot/compilers/ncigen/nci_gen.pl | 02:18 | ||
slavik | will take a look | ||
HA! fuck that, there's already SDL there ^^ | 02:20 | ||
err, there's an SDL pir :) | 02:21 | ||
ha, there IS data dumper :) | 02:28 | ||
02:31
elmex left
02:32
alc joined
02:38
slavik left
03:04
eternaleye left
03:09
hercynium joined
03:30
hercynium left
03:34
hercynium joined
03:37
alester_ joined
03:39
dalek left
03:40
dalek joined
03:42
Psyche^ joined
03:45
jnthn joined
03:47
wolverian joined
03:53
wolverian left,
wolverian joined
03:54
dalek left
03:55
dalek joined
03:57
pmichaud joined,
pugs_svn joined
03:58
Patterner left,
Psyche^ is now known as Patterner,
d4l3k_ joined,
wolverian left,
wolverian joined
04:06
d4l3k_ left,
pmichaud left
04:07
PerlPilot joined,
PerlPilot left
04:08
Southen_ joined
04:10
d4l3k_ joined,
pmichaud joined
04:15
pmichaud left,
Southen left
04:17
pugs_svn left,
pugs_svn joined
04:18
Limbic_Region left
04:22
PerlJam joined,
dalek left
04:23
d4l3k_ is now known as dalek
04:24
pmichaud joined
04:30
Entonian joined
04:36
km2 left
04:38
km2 joined
04:48
[particle]1 joined,
[particle]1 left
05:04
bacek left
05:09
bacek joined
05:26
Entonian left
05:48
jjore joined
06:03
hercynium left
06:41
DemoFreak joined
06:58
ashizawa joined
07:26
alester_ left
07:27
Bzek joined
07:38
jferrero joined,
sri_kraih joined
07:39
adc_penner joined
08:20
pbuetow joined
08:23
smallfish joined
08:35
bacek_ left
08:38
pbuetow left
08:46
km2 left
08:52
iblechbot joined
08:54
Jedai left
09:07
elmex joined
09:08
ejs joined
09:12
Jedai joined
09:24
DemoFreak left
09:26
adc_penner left
09:43
agentzh left
09:46
agentzh joined
09:49
jimmy__ joined
09:51
jimmy__ left
09:58
renormalist joined
09:59
smallfish left
|
|||
pugs_svn | r23070 | hinrik++ | First stab at Pod highlighting | 10:21 | |
literal | test, please :) | 10:22 | |
10:26
smg joined
10:35
alc left
10:36
iblechbot left
|
|||
moritz_ writes tests nearly every day | 10:57 | ||
but that's not what you meant, no? :-) | 10:59 | ||
tested on STD.pm, it doesn't seem to do very much, but doesn't cause troubles either | 11:00 | ||
11:18
pmichaud left,
pmichaud joined,
pnu joined,
yahooooo joined,
diakopter joined
11:32
wayland76 left
11:58
iblechbot joined,
jferrero left
12:10
c9s left
12:16
c9s joined
12:20
ejs_ joined,
ejs left
12:53
sri_kraih_ joined
13:06
mtrimpe joined
13:07
sri_kraih left
13:40
ashizawa left
13:56
pugs_svn left,
pugs_svn joined
14:02
masak joined
14:11
apeiron left
14:17
smg left
14:20
apeiron joined
14:31
ejs_ left,
ejs_ joined
|
|||
masak | std: my $a = *-4; say $a | 14:33 | |
p6eval | std 23070: OUTPUT[STD.pm did not return a true value at tryfile line 3.ā¤BEGIN failed--compilation aborted at tryfile line 3.ā¤] | ||
moritz_ | installing YAML::Syck on timtowtdi.org... | 14:36 | |
std: my $a = *-4; | 14:37 | ||
p6eval | std 23070: OUTPUT[can't create lex/STD/nofun_01.store: Permission denied at Cursor.pm line 521ā¤00:05 77mā¤] | ||
moritz_ | oh my, why can't it just work? | 14:38 | |
moritz_ thinks about giving up the distinction between users 'evalenv' and 'evalbot' | |||
masak | why is the distinction there in the first place? | 14:40 | |
moritz_ | for security reasons | 14:43 | |
PerlJam | I feel more secure. :) | 14:44 | |
masak | 'you are not authorized to receive this answer' | 14:45 | |
moritz_ | std: my $a = *-4; | ||
p6eval | std 23070: OUTPUT[00:05 82mā¤] | ||
moritz_ | IMHO it's quite a good idea that a process doesn't have write permissions to its executable :) | 14:46 | |
uhm, not quite the answer you're interested in, I guess | |||
it just calls tryfile | |||
masak | I don't really understand the answer | ||
moritz_ | it needed 5 seconds and 83 MB RAM :) | 14:47 | |
masak | that's a lot of RAM | ||
moritz_ | std: 3 * ( | 14:48 | |
p6eval | std 23070: OUTPUT[############# PARSE FAILED #############ā¤(Possible runaway string from line 1 to line 1)ā¤Can't understand next input--giving up at /tmp/UE4PtSghjf line 0:ā¤------> ā¤ expecting semicolon listā¤00:05 80mā¤] | ||
moritz_ | masak: so if you see just the run time + mem usage it means "parsed OK" | 14:49 | |
masak | moritz_: I'd prefer a simple 'yes' or 'no' from IRC STD | ||
is that too much to ask? :P | 14:50 | ||
moritz_ | masak: feel free to hack evalbot.pl :) | ||
masak | urgh | ||
anyone else have a tuit to spare? | |||
moritz_ | masak: I made the mistake earlier of using a modified version of tryfile, which then caused a conflict in svn, so I decided it wasn't a good idea, but didn't implement a better idea either | 14:51 | |
masak | oic | ||
back instead to the topic at hand: I'm thinking *-4 is evaluated inside the brackets of an array index, and that the result will be a Whatever object with some offset attribute set to -4 | 14:57 | ||
does that sound sane? | |||
jnthn | Ouch...maybe... | 14:58 | |
jnthn hadn't thought about this one so much | |||
moritz_ | masak: I think that's the case, yes | ||
masak | if it doesn't throw off any other plans, I could have a go at implementing it today. | 14:59 | |
moritz_ wonders if the Whatever star is actually a backdoor to get symbolic calculations done in Perl 6 :-) | |||
rakudo_svn | r33191 | jonathan++ | [rakudo] Eliminate a now-unrequired global. | 15:00 | |
masak | moritz_: all is fair if you predeclare. :) | ||
moritz_ | or maybe * ist just a hidden closure, so that if you say 'my $x = *-4; $x(0)' you get -4 | 15:01 | |
masak | interesting idead | 15:03 | |
*idea | |||
and array indices would then be called with $ix(@a.elems) | 15:04 | ||
moritz_ | however there needs to be some kind of introspection still for infinite ranges | 15:07 | |
15:10
renormalist left
15:12
renormalist joined
15:13
renormalist left
15:14
schmalbe joined,
renormalist joined,
renormalist left
15:15
renormalist joined
15:16
alester left
|
|||
masak | moritz_: I'd say my idea wins over yours in terms of simplicity :) | 15:16 | |
moritz_ | masak: right :) | 15:17 | |
masak: but mine wins in terms of creativity :) | |||
masak | definitely. | ||
15:18
rindolf joined
15:31
cognominal left
15:32
alester joined
15:35
Lorn joined
15:39
mncharity joined
15:41
Abraham joined
15:46
ZuLuuuuuu joined
15:47
smg joined
15:58
stephens joined
|
|||
mncharity | thanks TimToady :) (re nesting) | 16:02 | |
16:03
lrcg joined
16:08
Exodist joined
16:09
Exodist left,
Exodist joined
16:15
ZuLuuuuuu left
16:16
mtrimpe left,
mtrimpe joined
16:26
hercynium joined
16:28
lrcg left
16:36
jhorwitz joined
16:37
dukeleto_ joined,
ejs_ left
16:39
ejs_ joined
16:49
riffraff joined
16:51
justatheory joined
|
|||
rakudo_svn | r33192 | jonathan++ | [rakudo] Recognize ;; parameter separator; set invocant and multi_invocant fields in the signature. | 17:00 | |
17:00
Abraham left
17:02
mtrimpe left
17:05
mtrimpe joined
17:07
ruoso joined
17:15
ejs_ left
|
|||
rakudo_svn | r33193 | pmichaud++ | Merge lexicals branch into trunk. "make realclean" required (new opcodes). | 17:20 | |
ruoso | Hello! | 17:21 | |
17:21
dukeleto_ left,
riffraff left
17:22
riffraff joined
|
|||
ruoso | rakudo: class Foo { }; say &Foo() | 17:32 | |
p6eval | rakudo 33193: OUTPUT[invoke() not implemented in class 'Foo'ā¤current instr.: '_block11' pc 25 (EVAL_12:17)ā¤] | ||
ruoso | rakudo: class Foo { }; say &Foo; | ||
p6eval | rakudo 33193: OUTPUT[Fooā¤] | ||
ruoso | that's strange... | ||
&Foo was supposed to be a sub that returns the class Foo, wasn't it? | |||
jnthn | Oh? | 17:33 | |
moritz_ | that seems NYI | ||
jnthn | I hadn't seen that spec'd. | ||
I'd have expected an error. | |||
OTOH, type name handling is kinda funky in Rakudo at the moment... | |||
ruoso | jnthn, at least that's how STD parses it | 17:34 | |
std parses Foo.bar as &Foo().bar() | |||
moritz_ | not sure that's intended that way | ||
ruoso | moritz_, it is, already confirmed by TimToady | 17:35 | |
jnthn | Me either. | ||
OK, I can believe it parses that way. | |||
ruoso | it kinda makes sense, since there are no bare words | ||
jnthn | I'm not so sure on the whole "class definition introduces a sub of the same name" thing. | ||
I guess you can just implement invoke on a proto to return itself though. So it's no hassle if that's what's supposed to happen. | 17:36 | ||
But I'd like to see it in a spec before I make it work. | |||
ruoso wonders if that's related to something I saw a long time ago... | 17:37 | ||
rakudo: class foo { }; say foo; | |||
p6eval | rakudo 33193: OUTPUT[invoke() not implemented in class 'foo'ā¤current instr.: '_block11' pc 19 (EVAL_11:13)ā¤] | ||
ruoso | ok... that was a long time ago | ||
jnthn | Yes, now you've found the "can't have a class with a lowercase name" thingy in Rakudo. :-)_ | ||
masak | is there a ticket for that? | 17:38 | |
jnthn | (We aren't registering stuff in the namespace as we go yet, so we use "does it start with an uppercase letter" as a heuristic) | ||
masak: I dunno, but there's a grant proposal for it. ;-) | |||
masak makes a ticket, Justin Case | |||
moritz_ | I think we already have one, but I'm not sure | 17:39 | |
jnthn hopes to get that issue resolved in December | 17:40 | ||
masak | what's December, another wiki project? | ||
:P | |||
jnthn | Yeah! It's my secret one, implemented in Perl 7! | 17:42 | |
ruoso | ah... ok... so it's related to that bug... | ||
well... I think that's why Foo.bar is parsed as &Foo().bar() | |||
to solve that problem | |||
jnthn | Huh? But at parse name we'd know Foo is a type name... | 17:43 | |
masak | jnthn: dang! I shouldn't have let you take that vacation. | ||
[particle] thinks December is a good codename for a perl 6 DBI project | |||
masak would like a Perl 6 DBI project | 17:44 | ||
jnthn | *at parse time | ||
PerlJam | What ever happened to Tim Bunce's DBI 2 or whatever project? | 17:45 | |
pugs_svn | r23071 | moritz++ | [t/spec] unfudge passing rakudo test after lex branch merge (in for.t) | ||
[particle] | pj: it's in the Design Before Implementing state | ||
ruoso | jnthn, knowing that Foo is a type name is an optimization | ||
PerlJam | hasn't it been that way for like 3 or 4 years now? (yes, I know, I know ... don't say it) | 17:46 | |
jnthn | ruoso: I think otherwise - token typename does an assertion in there to see if we have a valid type name. | 17:47 | |
Thus affecting the match. | |||
If I understand the grammar correctly, anyways. | 17:48 | ||
ruoso checking STD | |||
moritz_ | nopaste.snit.ch/14722 # is that my error, or the next rakudo fuckup? | ||
jnthn | moritz_: I think there's a ticket about calling lexical subs not being quite right already | 17:49 | |
ruoso | jnthn, the token typename is used on places that only typenames are allowed | ||
jnthn, but Foo.bar is not one of those places | |||
jnthn | Ah. | ||
ruoso | it's a regular statement | ||
jnthn | ruoso: Doesn't it parse as term:name? | 17:50 | |
In this case? | 17:51 | ||
ruoso | hmmm... I think it parses as an EXPR | ||
ruoso checking | |||
jnthn | It'd seem strange to always interpreter it as a sub call when we can know at compile time what it is. | 17:52 | |
*iterpret | |||
ruoso | jnthn, that's why I said it's an optimization | 17:54 | |
to know it is a type name, I mean | |||
jnthn | I prefer the view that we know what it is at parse time. | 17:55 | |
TimToady | they're combined in STD to simplify the lexer, but it certainly knows the difference even then, or it wouldn't be calling is_type | ||
17:55
adc_penner joined
|
|||
jnthn | TimToady: So should &Foo() actually work? | 17:55 | |
If you've declared, say, class Foo { } | |||
TimToady | well, we certainly know that Foo($bar) is a function | 17:56 | |
jnthn | Yes, that's clear | ||
What about Foo.bar? | |||
TimToady | Foo() is just the coercion that happens to return the protoobject | ||
jnthn | OK, so if you invoke a proto-object, it returns itself? | ||
TimToady | yes, which can be optimizized away | 17:57 | |
17:57
Bzek left
|
|||
jnthn | OK. | 17:57 | |
TimToady | as long as there are no args | ||
jnthn | Sure | ||
ruoso | hmm... | ||
so Foo should point to the package | |||
and Foo() coerces to the protoobject | 17:58 | ||
is it? | |||
jnthn | Foo is the proto-object. | ||
pugs_svn | r23072 | moritz++ | [t/spec] add integration test by Donald Knuth, "Man or Boy" | ||
r23072 | moritz++ | (for stress-testing lexical variables and subs). pugs++ passes them. | |||
TimToady | we use package and proto-object more or less interchangably except in contexts that care | ||
jnthn | It refers to the package in, say, Foo::bar style things though. | ||
TimToady | which is mostly just hash subscripting | ||
ruoso | is that defined by syntax? | ||
TimToady | Foo{} is reserved, while Foo::{} subscripts the package | 17:59 | |
jnthn | *nod* | ||
TimToady | it's all valid syntax, so it has to be distinguished in semantic analysis | 18:00 | |
ruoso | and if I want the package object? | ||
Foo.WHO | |||
jnthn, anyway... in Foo.bar, Foo is a term, you were right | |||
18:00
riffraff left
|
|||
TimToady | $x = Foo:: should return that | 18:00 | |
jnthn | $x = Foo::; # valid? :-) | 18:01 | |
TimToady | yes, valid | ||
jnthn | OK | ||
ruoso | although ugl | ||
ugly | |||
jnthn | Yes. | ||
TimToady | indeed | ||
jnthn | But I don't think you'd want to do it much. | ||
Foo.WHO is much clearer. | 18:02 | ||
TimToady | ugliness is a form of dehuffmanization | ||
not really | |||
jnthn | Or allowance of obsfucation. | ||
18:02
spx2 left
|
|||
TimToady | it's only clearer because you already know what WHO does. :) | 18:02 | |
pugs_svn | r23073 | moritz++ | [t/spec] set svn props for man-or-boy.t | 18:03 | |
ruoso | nah... WHO is intuitive | ||
TimToady | sez WHO!?! | ||
[particle] | WHO is just sugar for Foo:: :) | ||
18:03
spx2 joined
|
|||
jnthn | It's probably a tad easier to go look up. | 18:03 | |
'cus it looks like a method call...which it isn't. :-) | |||
TimToady | WHO'd a thunk it? | ||
ruoso | [particle], considering you don't support changing the class package in runtime ;) | ||
PerlJam | Woo.WHO | 18:04 | |
TimToady | we need a Foo.HUH? | 18:05 | |
moritz_ | rt.perl.org/rt3/Ticket/Display.html?id=60404 should the number of iterations be 4, 1 and 3? | 18:07 | |
lambdabot | Title: #60404: Array becomes string in subroutine or method calls | ||
[particle] | Foo.SAYWHA calls MetaData::Dumper | 18:08 | |
18:09
justatheory left
|
|||
masak | TimToady: yes, please add a .HUH metamethod! :P | 18:13 | |
Uh.HUH | |||
(maybe we should rename Nil to Uh) | |||
18:17
cognominal joined
18:18
pbuetow joined
|
|||
[particle] | Uh is a Failure that gets confused about what context it should return in | 18:18 | |
18:20
rindolf left
|
|||
PerlJam | Then Nil is really more like an Idunno | 18:20 | |
masak | or BuggerAll | 18:22 | |
18:26
vixey joined
|
|||
pugs_svn | r23074 | moritz++ | [t/spec] add tests for RT #60404 | 18:29 | |
r23075 | moritz++ | [t/spec] svn props for passing-arrays.t | |||
r23076 | moritz++ | [t/spec] various unfudges for rakudo | 18:32 | ||
rakudo_svn | r33194 | moritz++ | [rakudo] add tests for [perl #60404] to t/spectest.data | 18:50 | |
18:51
DemoFreak joined
|
|||
mncharity | TimToady: fyi, the Match tree for $.m(3) has an empty postcircumfix array in the variable. The postcircumfix:( ) instead shows up as a surrounding postop. Intended? I should be able to work with it, though I'm still exploring. | 18:55 | |
18:55
DemoFreak left
|
|||
vixey | oo do you have STD.pm running now? | 18:56 | |
masak | vixey: oh yes. | ||
vixey | great! | ||
masak | it is. | ||
feels like living in the future. | |||
vixey | I missed when this happened :( | ||
masak | I think it was running already in August | 18:57 | |
pugs_svn | r23077 | hinrik++ | Commented some of the Pod stuff in perl6.vim | ||
literal | @tell azawawi perl6.vim can do Pod now, you might want to try it | 19:03 | |
lambdabot | Consider it noted. | ||
19:04
DemoFreak joined
|
|||
mncharity | vixey: elf has been self-compiling on a hand-implemented STD.pm derivative since end of March. :) misc/elfish/STD_blue is the/my current effort to improve elf, STD.pm, and gimme5 to the point elf can self-compile on gimme5 running the current STD.pm. | 19:04 | |
exercise after that will be teaching elf to itself run STD.pm directly. | |||
vixey | yeah I was hacking elf a little bit when it was using the ruby STD | 19:05 | |
so is there a post about when STD started to run? :) | |||
literal | @tell TimToady STD.pm has stuff like "=begin comment overview" which doesn't make sense according to S26 (shouldn't it rather be "=begin Overview"?) | ||
lambdabot | Consider it noted. | ||
mncharity | "STD started to run"? depends what you mean. | 19:07 | |
19:07
apeiron left
|
|||
mncharity | elf is still using the ruby STD_red. though a couple of the elf source files can now be compiled with STD_blue. | 19:08 | |
19:14
apeiron joined
|
|||
masak | rakudo: my $a = 5; $a = [ $a, 6 ]; say $a | 19:15 | |
p6eval | rakudo 33193: OUTPUT[maximum recursion depth exceededā¤current instr.: 'parrot;List;get_string' pc 2808 (src/gen_builtins.pir:1885)ā¤] | 19:16 | |
masak | jnthn: I think you should see this. | ||
pugs_svn | r23078 | putter++ | [elf_h] Fixed incorrectly escaped string literals. Tolerate undefs in statementlist arrays, for STD_blue development. | 19:18 | |
r23079 | putter++ | [STD_blue] Improved AST gen for temp() and strings. Working on $.e(3) variable method calls. | 19:27 | ||
r23079 | putter++ | Compiler.pm and CommandLine.pm now emit identically. Pursuing EmitSimpleP5.pm. | |||
19:30
mtrimpe left
|
|||
mncharity | arg. will a "channel operator" please /topic The topic for #perl6 is: pugscode.org/ planetsix.perl.org/ | nopaste: sial.org/pbot/perl6 | pugs: [~] <m oo se> (or rakudo:, kp6:, elf: etc.) (or perl6: for all) | irclog: irc.pugscode.org/ | 19:38 | |
thus adding planet. | |||
since when does #perl6 have a locked topic??? | |||
vixey: re post, I think it went by on the design meeting summaries at some point. planetsix is now unbroken, and accepting feed additions, so there's an opportunity to blog... | 19:39 | ||
TimToady | The topic for #perl6 is: pugscode.org/ planetsix.perl.org/ | nopaste: sial.org/pbot/perl6 | pugs: [~] <m oo se> (or rakudo:, kp6:, elf: etc.) (or perl6: for all) | irclog: irc.pugscode.org/ | 19:41 | |
mncharity | danke | 19:42 | |
happy turkeying all. & | |||
19:43
mncharity left
19:50
sri_kraih_ left
19:58
jferrero joined
20:01
smg left
20:04
sri_kraih joined,
schmalbe left
20:24
masak left,
masak joined
|
|||
jnthn | masak: File rakudobug... | 20:32 | |
masak | jnthn: aye aye! | ||
jnthn is having Rakudo day tomorrow - will spend some time on the RT queue. | |||
Continue the ticket filing/resolving tug of war with masak, which he is epicly winning... | |||
masak | muhahaha | 20:33 | |
the dark side always wins. | |||
jnthn | It's only so dark because you're so far north up there. :-P | 20:34 | |
masak | jnthn: I woke late today. almost missed sunset. it's true! | 20:36 | |
but it does perhaps tell more about my sleeping habits... | |||
20:38
km3 joined
|
|||
jnthn | Oh, since I came back from Parrot Summit, my sleep has been *way* messed up. | 20:41 | |
I work from home though, so nobody much cares. | 20:42 | ||
Well, I cared when I realized I had to get up at 8:30am on Sunday, but... | |||
masak | heh | 20:50 | |
20:51
Lorn left
|
|||
rakudo_svn | r33203 | pmichaud++ | [rakudo]: Remove gather workaround introduced in r31116 (RT #58854, Tene++) | 21:00 | |
21:06
masak left
21:07
ruoso left
|
|||
literal | I'm using Pugs, how do I install the modules in ext/ ? | 21:08 | |
a "perl Makefile.PL && make install" doesn't seem to do the trick | 21:09 | ||
21:11
Limbic_Region joined
21:18
donaldh joined
|
|||
pugs_svn | r23080 | hinrik++ | Some cleanup in perl6.vim | 21:30 | |
r23081 | moritz++ | [t/spec] move subtypes.t to S12 section, don't know what it did in S02 | |||
21:32
smg joined
|
|||
moritz_ | literal: dunno, your best bet is to copy them somewhere and set the PERL6LIB accordingly | 21:34 | |
literal | ok | 21:35 | |
pugs_svn | r23082 | moritz++ | [t/spec] more subtype tests | 21:39 | |
rakudo_svn | r33206 | moritz++ | [rakudo] follow a moved test in spectest.data | 21:40 | |
literal | is this [] thing just a convention or is there some tool that inserts it for you? | 21:41 | |
pugs_svn | r23083 | moritz++ | [t/spec] merge subset-code.t and subset-range.t into a single subset.t | 21:42 | |
literal | in the svn commit messages | ||
moritz_ | literal: it's a convention to track which part of the repo changed, and it also makes it easier to filter commit message mails by automated rules | ||
21:43
simcop2387 joined
|
|||
literal | ok, so you type it manually. Just the path name? | 21:43 | |
moritz_ | depends. I use [t] or [t/spec] for all test commits, but others use the project name of their sub project | 21:44 | |
literal | ok | ||
moritz_ | for example smop commits have [smop] instead of [v6/smop], TimToady uses [STD.pm] for must stuff under src/perl6/... | ||
jnthn | moritz_: Ah. I should probably use that instead of [spectest]. :-) | 21:46 | |
21:47
iblechbot left
|
|||
moritz_ | jnthn: yes, but I know what's meant with [spectest] as well ;-) | 21:47 | |
(but [t/spec] is shorter to type ;-) | |||
rakudo: my $x; subset MyInt of Int where { $^num % x == 0}; say 'alive'; | 21:50 | ||
p6eval | rakudo 33206: OUTPUT[aliveā¤] | ||
rakudo_svn | r33207 | moritz++ | [rakudo] track merge test files in spectest.data | ||
moritz_ | rakudo: my $x; subset MyInt of Int where { $^num % x == 0}; $x = 5; my MyInt $a = 10; say $a; | ||
p6eval | rakudo 33206: OUTPUT[get_iter() not implemented in class 'Integer'ā¤current instr.: 'prefix:=' pc 14946 (src/gen_builtins.pir:9263)ā¤] | ||
moritz_ | rakudo: my $x; subset MyInt of Int where { $^num % $x == 0}; $x = 5; my MyInt $a = 10; say $a; | 21:51 | |
p6eval | rakudo 33206: OUTPUT[Type mismatch in assignment.ā¤current instr.: 'die' pc 12219 (src/gen_builtins.pir:7463)ā¤] | ||
moritz_ | rakudo: my $x = 5; subset MyInt of Int where { $^num % $x == 0}; $x = 5; my MyInt $a = 10; say $a; | ||
p6eval | rakudo 33206: OUTPUT[Type mismatch in assignment.ā¤current instr.: 'die' pc 12219 (src/gen_builtins.pir:7463)ā¤] | ||
moritz_ | rakudo: my $x = 5; subset MyInt of Int where { $^num % $x == 0}; my MyInt $a = 10; say $a; | ||
p6eval | rakudo 33206: OUTPUT[Type mismatch in assignment.ā¤current instr.: 'die' pc 12219 (src/gen_builtins.pir:7463)ā¤] | ||
moritz_ smells another rakudo bug | |||
rakudo: my $x = 5; subset MyInt of Int where { $^num % $x == 0}; my $a = 10; say $a; | 21:52 | ||
p6eval | rakudo 33206: OUTPUT[10ā¤] | ||
moritz_ | rakudo: my $x = 5; subset MyInt of Int where { $^num % $x == 0}; my $a = 10; say $a ~~ MyInt; | ||
p6eval | rakudo 33206: OUTPUT[0ā¤] | ||
jnthn | moritz_: Yes, I'm aware of the subsets and lexicals issue. | 21:54 | |
There's a spectest currently fudged because of that. | |||
moritz_ | jnthn: I'm writing a ticket right now, and reviewing the test as well (which is a bit confusing right now= | 21:55 | |
jnthn | Sure. | ||
I may not fix that until the :subid changes are in place properly. | |||
moritz_ | no hurry from my side | 21:56 | |
pugs_svn | r23084 | moritz++ | [t/spec] make subtypes.t a bit more intuitive | 21:58 | |
r23085 | hinrik++ | [util/perl6.vim] remove some old Pod stuff, fix issue with abbreviated blocks | 22:03 | ||
22:07
km3 is now known as km2
|
|||
pugs_svn | r23086 | hinrik++ | [examples/euler] Correct Pod and add vim modeline to all files | 22:08 | |
22:11
adc_penner left
22:13
alester left
22:15
wayland76 joined
|
|||
wayland76 | Saw lexicals. pmichaud++ :) | 22:16 | |
rakudo_svn | r33209 | pmichaud++ | [rakudo]: Add quote with multiple bracket characters, and texas quotes. | 22:20 | |
r33209 | pmichaud++ | * Partially fixes RT #60670. | |||
pugs_svn | r23087 | moritz++ | [t/spec] unfudge quoting.t, pmichaud++ | 22:21 | |
pmichaud | rakudo: say << foo >>.perl; | 22:26 | |
p6eval | rakudo 33208: OUTPUT[1ā¤] | ||
22:26
spx2 left
|
|||
pmichaud | (still not updated yet -- can't show off.) | 22:26 | |
22:26
TomDLux joined
|
|||
moritz_ | rakudo: say << foo bar >>.perl; | 22:27 | |
p6eval | rakudo 33208: OUTPUT[["foo", "bar"]ā¤] | ||
moritz_ | (the revision number isn't updated, but the binary is) | ||
22:28
mtrimpe joined
|
|||
TimToady | rakudo: say join ':', << foo bar >>; | 22:28 | |
lambdabot | TimToady: You have 1 new message. '/msg lambdabot @messages' to read it. | ||
p6eval | rakudo 33208: OUTPUT[foo:barā¤] | ||
22:30
spx2 joined,
TomDLux left
|
|||
pmichaud | I haven't quite figured out what to do with something like: | 22:31 | |
my $a = 'foo bar'; my $b = 'baz'; say << $a$b >>.perl; | |||
or | 22:32 | ||
my $a = 'foo bar'; my $b = 'baz'; say << xyz$a$b/2 >>.perl; | |||
moritz_ | I'd say first interpolate, then .comb(/\S+/) | ||
TimToady | I think the close to what a shell would do, the happier people will be | ||
*closer | 22:33 | ||
moritz_ | so the first would give ('foo', 'barbaz') | ||
and the second ('xzyfoo', 'bar/2') | |||
right? | |||
pmichaud | my $a = 'foo bar'; say << $a"baz" >>; # also ('foo', 'barbaz') ? | 22:34 | |
TimToady | but << "$a$b" >> would give one string | ||
pmichaud | right. | ||
that's what makes it a little tricky | |||
moritz_ | why have double quotes a special meaning <<...>? | ||
pmichaud | we have to know what to concatenate and what to split. | ||
rakudo: my $a = 'foo bar'; say << xyz "$a" abc >>.perl; | 22:35 | ||
p6eval | rakudo 33209: OUTPUT[["xyz", "foo bar", "abc"]ā¤] | ||
literal | TimToady: I have a question (see lambdabot) | ||
pmichaud | rakudo: my $a = 'foo bar'; say << xyz '$a' abc >>.perl; | ||
p6eval | rakudo 33209: OUTPUT[["xyz", "\$a", "abc"]ā¤] | ||
pmichaud | rakudo knows those already. | ||
it's just the concatention+split that gets a bit tricky. :-) | 22:36 | ||
TimToady | literal: the pod syntax is still being revised, so who knows what TheDamian will end up with | ||
moritz_ wouldn't expect so much magic in texas quotes | |||
pmichaud | *concatenation | ||
moritz_: they're essentially "shell quoting" | |||
literal | I see | ||
moritz_ | pmichaud: I see, that's new to me :) | ||
literal | for ^($n -1) { ... } <-- what does the ^ there mean? | 22:37 | |
moritz_ | literal: ^$x is 0..($x-1) | ||
jnthn | literal: 1..$n-1 | ||
TimToady | short for 0..^($n-1) | ||
jnthn | erm, 0.. :-) | ||
literal | ok | ||
TimToady | in other words, 0..($n-2) | 22:38 | |
moritz_ | rakudo: say ^4 | ||
p6eval | rakudo 33209: OUTPUT[0123ā¤] | ||
pmichaud | rakudo: say ^4.perl; | ||
p6eval | rakudo 33209: OUTPUT[0123ā¤] | ||
moritz_ | TimToady: I always thought it went to $n-1, inclusive... is that new? | ||
pmichaud | rakudo: say (^4).perl; | ||
p6eval | rakudo 33209: OUTPUT[0..^4ā¤] | ||
TimToady | which is wrong | ||
pmichaud | ...which one is wrong? | 22:39 | |
moritz_ | wasn't ^@array intended to be the range of indices? | ||
TimToady | well, ^4.perl isn't doing what you think | ||
pmichaud | 4.perl returns "4", and then ^"4" is ... ? | ||
TimToady | presumably | ||
rakudo: ^4.say | 22:40 | ||
p6eval | rakudo 33209: OUTPUT[4ā¤] | ||
TimToady | rakudo: (^4).say | ||
p6eval | rakudo 33209: OUTPUT[0123ā¤] | ||
pmichaud | rakudo is fun sometimes. :-) | 22:41 | |
TimToady | moritz_: +@array is off the end | ||
so ^@array goes to @array-1 | 22:42 | ||
same as 0 ..^ @array | |||
jnthn wonders if Rakudo got the order of precedence right in ^4.say | |||
moritz_ | TimToady: ah, I missed the ($n-1) in the original question | ||
pmichaud | jnthn: method calls are tighter than prefix, I think. | ||
TimToady | yes, it's behaving as specced | ||
jnthn | I thought so too | ||
pmichaud | (whew!) | 22:43 | |
TimToady | it just doesn't DWIM :/ | ||
22:43
araujo left
|
|||
moritz_ | I think it's good enough ;-) | 22:44 | |
pmichaud | rakudo: my @a = <jan feb mar apr may jun jul aug sep oct nov dec>; say ^@a; # this one goes to 11. | ||
p6eval | rakudo 33209: | ||
..OUTPUT[0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849... | |||
pmichaud | ...or maybe not. | ||
I'll figure that one out later, or wait for masak++ to file it as a bug. :-) | 22:45 | ||
moritz_ | well, I can do that too | ||
pmichaud | that works also. right now I'm only solving easy bugs. | ||
TimToady | rakudo: my @a = <jan feb mar apr may jun jul aug sep oct nov dec>; say +@a; | 22:46 | |
p6eval | rakudo 33209: OUTPUT[12ā¤] | ||
TimToady | rakudo: my @a = <jan feb mar apr may jun jul aug sep oct nov dec>; say ^+@a; | ||
p6eval | rakudo 33209: OUTPUT[01234567891011ā¤] | ||
pmichaud | I think prefix:^ isn't properly contexting its argument. | ||
sorry, wrong channel. prefix:<^> | |||
TimToady | :) | 22:47 | |
22:47
donaldh left
|
|||
moritz_ | rakudo: my @a = 'janu'; say (^@a).elems | 22:48 | |
p6eval | rakudo 33209: OUTPUT[1000ā¤] | ||
moritz_ | rakudo: my @a = 'janua'; say (^@a).elems | ||
p6eval | rakudo 33209: OUTPUT[10000ā¤] | ||
moritz_ | rakudo: my @a = 'januar'; say (^@a).elems | ||
p6eval | rakudo 33209: OUTPUT[100000ā¤] | ||
TimToady | rakudo: it's doing string incr | ||
pmichaud | in that case I *know* it's not properly assigning @a | ||
p6eval | rakudo 33209: OUTPUT[Could not find non-existent sub incrā¤current instr.: '_block11' pc 13 (EVAL_13:13)ā¤] | ||
pmichaud | my @a = 'janu'; say @a.elems; | ||
rakudo: my @a = 'janu'; say @a.elems; | 22:49 | ||
p6eval | rakudo 33209: OUTPUT[1ā¤] | ||
pmichaud | oh, maybe it is. | ||
hrm. | |||
TimToady | rakudo: say ^'a' | ||
p6eval | rakudo 33209: OUTPUT[ā¤] | ||
moritz_ | rakduo: say ^'ab' | ||
pmichaud | anyway, should be easy to fix.... but later. | ||
TimToady | commuting & | ||
pugs_svn | r23088 | hinrik++ | [util/perl6.vim] adjust indenting options slightly | 22:50 | |
moritz_ can find only one test with ^@something in t/spec/ | 22:51 | ||
rakudo: say 3 ~~ ^10 | 22:57 | ||
p6eval | rakudo 33209: OUTPUT[1ā¤] | ||
moritz_ | rakudo: say 3.5 ~~ ^10 | ||
p6eval | rakudo 33209: OUTPUT[1ā¤] | ||
moritz_ | rakudo: say 9.9 ~~ ^10 | ||
p6eval | rakudo 33209: OUTPUT[1ā¤] | ||
moritz_ | that's correct, I hope? | 22:58 | |
jnthn | Believe so. | ||
pmichaud | rakudo: say 10 ~~ ^10; | 22:59 | |
p6eval | rakudo 33209: OUTPUT[0ā¤] | ||
jnthn | moritz_: It seems we don't have much in the way of tests for multimehtods, or am I missing them? | ||
I know there's the is default one, but I don't see much beyond that. | |||
moritz_ | jnthn: maybe also look in t/ (not t/spec), there many not-yet-moved OO tests there | ||
jnthn | moritz_: Ah, OK | 23:00 | |
svn.pugscode.org/pugs/t/ # failed to connect? | |||
lambdabot | Title: pugs - Revision 23088: /t | ||
jnthn | heh | ||
So why's it not work for me... | 23:01 | ||
moritz_ | perhaps the hourly apache restart? | ||
works here, try again please | |||
jnthn | Still not. :-( | 23:02 | |
The connection was refused when attempting to contact svn.pugscode.org. | |||
23:04
ZuLuuuuuu joined,
luqui joined
|
|||
pugs_svn | r23089 | moritz++ | [t/spec] tests for prefix:<^> | 23:04 | |
jnthn | moritz_: But strangely svn works... :-| | ||
so odd | |||
ah, owrks now | 23:05 | ||
:-S | |||
pugs_svn | r23090 | moritz++ | [t/spec] test that ^(something) actually returns a Range | ||
23:06
luqui left
|
|||
moritz_ | rakudo: my @a = <foo bar>; say (^@a).WHAT | 23:07 | |
p6eval | rakudo 33209: OUTPUT[Listā¤] | ||
TimToady | moritz_: 3 .. ^10 is incorrect | 23:08 | |
the operator is ..^ | |||
3 .. ^10 means 3 .. (0..9) | 23:09 | ||
moritz_ | TimToady: where did you see 3 .. ^10? | ||
TimToady | sorry, misread | ||
3 ~~ ^10 is fine | |||
what I get for bling t ofast | |||
23:10
hercynium left
|
|||
TimToady | typing to ofast t oo | 23:10 | |
moritz_ | ;) | ||
TimToady | and yes 9.9 ~~ ^10 is True | 23:11 | |
jnthn | TimToady: multi method bar(Array @array) { actually would test that that we got passed an @array where every element was an Array, right? | ||
TimToady | which rakudo confuses with 1 :) | ||
moritz_ | good, then the tests are right (and so is rakudo) | ||
TimToady | jnthn: correct | 23:12 | |
pmichaud | True stringifies to...? | ||
jnthn | TimToady: And similarly, multi method bar(Hash %hash) { makes sure that the values are all hashes... | ||
OK, good. | |||
moritz_ | so if you want to say that in 'my @Array' @Array should be an Array, not just a Positional, one would say that as 'my @Arrray of Array', or how? | 23:13 | |
pmichaud | my @array is Array, I think. | ||
TimToady | pmichaud: certainly it should numify to 1, and .perlify to True, but stringify on enums is debatable | ||
jnthn | Probably not of. | ||
pmichaud | TimToady: yes, I'm wondering/waiting for a decision on stringified enums. :-) | 23:14 | |
and it .perlifies to "True" and not "Bool::True"? | |||
jnthn | pmichaud: is works on declarations like that, I'm not sure that will fly for type checks on parameters. | ||
TimToady | depends on use cases, which never occur to me offhand :) | ||
jnthn | pmichaud: Since is applies a trait... | ||
TimToady: Any answers? :-) | |||
pmichaud | ( @array where { @array ~~ Array ) ) ? | 23:15 | |
jnthn | That'd *work* I'm sure. :-) | ||
It's not so pretty though I guess. | |||
pmichaud | s/')'/}/ | ||
TimToady | my @array is Array requires @array to be an Array | 23:16 | |
pmichaud | not everything is pretty. :-P | ||
TimToady | my @array does Array requires @array to do Array | ||
moritz_ | ok 'is', not 'of'. | ||
TimToady | as does @array ~~ Array | ||
which is defined as does, not is | |||
jnthn | TimToady: Array is a role? | ||
pmichaud | afk, dinner. | 23:17 | |
jnthn | role Array[::of] { ... } ? | ||
TimToady | maybe, doesn't matter, since ~~ degrades to is if there isn't a role | ||
but most of the built-in types are probably punned role/classes | |||
jnthn | TimToady: I'm trying to get the relationship between writing "of" and parametric roles straight in my head. | ||
my @array of Int; | 23:18 | ||
23:18
ZuLuuuuuu left
|
|||
moritz_ | seems pretty useless ;) | 23:18 | |
TimToady | yes that's Array[:of(Int)] or some such | ||
23:19
Auzon joined
|
|||
jnthn | OK, and we can instantiate it because the role implies the existence of a class Array too? | 23:19 | |
TimToady | yes, Array of Bool is much more useful | ||
jnthn | Or put another way, if I wanted to instantiate a typed array, just as you can create a new anything by doing Thingy.new, how does this look? | ||
Array[:of(Int)].new | 23:20 | ||
? | |||
TimToady | if role Array can be punned into class Array it probably means that the of parameter has a default of Object or some such | ||
jnthn | OK, so declare role Array[::of = Object] { ... } | 23:21 | |
*declared | |||
TimToady | the .new looks okay to me | ||
jnthn | Will that parse OK? | ||
TimToady | but S09 has more opinions about arrays. :) | ||
jnthn | I'm not so much expecting you'd write it like that, so much as working out what it boils down to under the hood. :-) | 23:22 | |
TimToady | STD likes it | ||
jnthn | OK, great. | ||
TimToady | desugaring, we usually say here | ||
jnthn | my Int @array; # it's SO sweet! | 23:23 | |
OK, so for hashes | |||
my Int %hash; # hash has values of type Int | |||
Presumably this looks a bit like | |||
TimToady | correct | ||
jnthn | role Hash[::of = Object, ::key = Object] { ... } | 23:24 | |
TimToady | my Int %hash{Str} is default | ||
object keys must be explicitly declared | |||
jnthn | Ah, OK | 23:25 | |
TimToady | so probably role Hash[::of = Object, ::key = Str] { ... } | ||
jnthn | OK, and we coerce to string on storage? | ||
pugs_svn | r23091 | moritz++ | [t/TASKS] jnthn++ needs multi method tests | ||
TimToady | assuming string is immutable, yes | ||
jnthn | How does that look? | 23:26 | |
TimToady | Str is immutable, in theory | ||
a Str variable tries to be smart about it though | |||
jnthn | method postcircumfix:<{}>(key $k, of $value) { ... } | 23:27 | |
TimToady | not sure our story is entirely straight there... | ||
jnthn | erm, multi method... | ||
Right, because this would imply in the signature "we require a key that's already a string" | |||
TimToady | need a space between {} too | ||
jnthn | Ah, yes. | ||
TimToady | and your named parameter syntax leaves something to be desired. | 23:28 | |
moritz_ | perhaps more like multi method postcircumfix:<{ }>($key as key, of $value) ? | ||
(assuming that 'key' and 'of' are types= | |||
jnthn | So would it be more like multi method postcircumfix:<{ }>($k, of $value) { $k .= Str } | ||
TimToady | ah | ||
jnthn | What named parameter syntax? | ||
Yes, key and of are the types we bound in the role. | |||
TimToady | not sure why you're feed values to a postcircumfix... | 23:30 | |
rakudo_svn | r33211 | jonathan++ | [rakudo] Some final bits to get multi methods working. | ||
moritz_ goes to bed and whishes the busy hackers and speccors the appropriate amount of fun | 23:31 | ||
TimToady | more like: multi method postcircumfix:<{ }> (*@@key as key --> of) | ||
jnthn | TimToady: Ah, duh. :-) | ||
OK, so "as" does the coercion. | |||
I'd forgot that was allowed on a parameter in a signature. | |||
OK, that makes sense. | |||
Is my X $foo{Y,Z} is C a general syntax we'd desugar to something like $foo := C[:of(X),Y,Z].new | 23:33 | ||
23:33
bacek_ joined
|
|||
jnthn | Or are the hash and array syntaxes a special case? | 23:33 | |
erm, the hash one | 23:34 | ||
TimToady | they may well be special; and in any case you shouldn't pass positionals after a named :P | ||
jnthn | :P | ||
I should really try learning Perl 6 some day... | |||
I'm asking this 'cus I'm planning to implement the parametric roles stuff in the not too distant future. :-) | 23:35 | ||
TimToady | you *may* pass positionals after named, but note that Y will be bound to ::of, leaving your :of arg bereft | ||
jnthn | Oh, I had one other question, then I'll leave you alone. :-) Where is the .mixin method you use in STD.pm defined? | 23:36 | |
TimToady | Cursor.pmc | ||
jnthn | Aha, OK, so it's a method on cursor objects. | ||
TimToady | everything is a method on cursor objects, pret' near | 23:37 | |
jnthn | The use of parametric roles in STD.pm is pretty cool. :-) | ||
TimToady | yeah, well, I may have to cheat on the starters and stoppers for speed, but for now it does it "right" | 23:38 | |
but each time I do it right I use up another 80meg or so of disk cache :) | |||
I'm hopeful that once my lexers get out of strings and into real data structures the means for compressing common patterns will be obvious. | 23:39 | ||
but it's a lot easier to understand in string form... | 23:40 | ||
jnthn | Well, make it work, then make it fast/compact. | ||
TimToady | also, the parameters on roles are rather limited at the moment | ||
jnthn | You don't get the full power of signatures there? | 23:41 | |
jnthn was planning to implement it so you did... | |||
TimToady | since they have to be faked by RE_var::longest | ||
well, p5 doesn't really have roles, so all mixins are basically some variant of eval | 23:42 | ||
jnthn | Ah, OK. | 23:43 | |
TimToady | the RE_var::longest code has to be cognizant that certain variables can be treated as constants wrt LTM | 23:44 | |
they're only variable across different packages | |||
jnthn tries to wrap his head around this | |||
So in | 23:45 | ||
role startstop[$start,$stop] { | |||
token starter { $start } | |||
TimToady | $start has to be treated as part of the longest token | 23:46 | |
jnthn | OK | ||
TimToady | and that is what the last method in Cursor, RE::var::longest, is doing. | ||
arguably those methods can go in a different file these days though, since they aren't actually Cursor methods | 23:47 | ||
jnthn | So when you do self.mixin( ::startstop[$start,$stop] ) then it needs to compile a specific version of the token with what's passed as $start and $stop constant from that point on? | ||
TimToady | yes, mixin generates a new package, moosed to be derived from the original, and evals the code in that package | 23:48 | |
it does not attempt to in-line $start and $stop though | 23:49 | ||
which is why it's faked in the longest | |||
23:49
Auzon left
|
|||
TimToady | in fact, it doesn't rewrite the generic routines at all | 23:49 | |
just uses the derivation of the original | |||
but longest knows which vars are to be treated as generic | 23:50 | ||
and the actual matcher doesn't care, since it just matches the runtime string | |||
jnthn | OK | 23:51 | |
TimToady | but it is currently limited to strings, really | ||
jnthn | I'll have to take a look at the code. | ||
And see what it's doing. | |||
TimToady | so p5 can use it for types, but only to the extent that p5 treats types as strings. | ||
jnthn | OK, but an implementation where roles were available first class wouldn't have that limitation? | 23:52 | |
TimToady | presumably. STD is only meant to bootstrap the compiler on p5 | 23:53 | |
it doesn't try for a perfect p5 implementation of p6 | 23:54 | ||
which would be very slow | |||
on the other hand, it's trying to do things correctly from the p6 perspective at least | 23:55 | ||
pugs_svn | r23092 | jnthn++ | [t/spec] Un-fudge a multi method test for 'is default' and add a few more multi method tests. More welcome and encouraged. | ||
TimToady | so p6 thinks it's a real mixin, even if p5 sees it as an eval that happens to fake up a mixin | ||
jnthn | OK. | 23:56 | |
jnthn thinks his brain is going to be kept busy for the coming months | |||
TimToady | so we really are relying on derivation for derived grammars, even if all the apparatus has to be faked up around it | ||
jnthn | *nod* | 23:57 | |
In theory, if I can get this right for roles and classes, I'd hope that roles with grammars would mostly fall out naturally. | |||
TimToady | and we really do go out and interrogate methods for their longest token sets, even though Cursor has a lot of excess familiarity with the innards | 23:58 | |
yes | |||
jnthn | OK. | ||
TimToady | and p5 doesn't really let you treat a method as an object, so we fake that too | ||
jnthn will try and get it right | 23:59 | ||
TimToady | wit the *_PEEK routines | ||
jnthn | Aha. | ||
TimToady | though we could conceivably do something with p5's sub attributes |