»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend! Set by sorear on 4 February 2011. |
|||
[Coke] | Am I the only one who heard that read in the style of monty python? | 00:04 | |
00:11
Chillance left
|
|||
lichtkind | good night | 00:12 | |
kthakore | good night | ||
masak | good ♞ | ||
lichtkind | hope you can use this tommorrow gist.github.com/4341223 | 00:13 | |
00:13
lichtkind left
00:23
LV left,
LordVorp joined
|
|||
kthakore | Hello I am trying to understand a bit of teh reasoning being Perl6 syntax. | 00:25 | |
when I use for @foo -> $bar { } | |||
japhb_ | Erg! I am really tired of Bug #115390! | 00:26 | |
kthakore | is that running as a for function? | ||
japhb_ | kthakore, -> $arg1, $arg2 { } is a "pointy block" | ||
It takes arguments like a Routine, but is not quite a full Routine (it is transparent to return, for example) | 00:27 | ||
So essentially you have "for @array &function", or rather [email@hidden.address] &function", because for is really just syntactic sugar for map | |||
00:29
cognominal left,
cognominal joined
|
|||
TimToady | that's the one syntax in Perl 6 that is allowed to have two terms in a row, by treating -> as an expression terminator | 00:29 | |
we do not (yet) allow users to tap into that syntax by mere function declaration | 00:31 | ||
dalek | rl6-bench: 3d37b43 | (Geoffrey Broadwell)++ | perl5/rc-man-or-boy-test: Make sure perl5/rc-man-or-boy-test is run with 5.010 features enabled |
00:32 | |
rl6-bench: 1a6126e | (Geoffrey Broadwell)++ | / (2 files): Build Perlito as a component, and switch to 'nodejs' instead of 'node' to call node_js VM |
|||
kthakore | cool | 00:33 | |
oh cool | 00:34 | ||
kthakore is just reading book a lot | 00:35 | ||
thanks | |||
00:40
cognominal left
00:50
cognominal joined
00:55
cognominal left
00:56
japhb_ left
00:57
bowtie left
01:01
larks left
01:03
larks joined
01:04
slayer101_ joined
01:06
cognominal joined
01:12
hypolin joined
01:14
cooper_ left,
cognominal_ joined,
cognominal left
01:15
anuby joined
01:23
cognominal_ left
01:30
cognominal joined
01:32
gdey left
01:35
cooper joined,
cooper left,
cooper joined
01:56
skids joined
02:33
arlinius left
02:58
FROGGS_ joined
03:02
FROGGS left
03:07
noggle joined
03:11
noggle_ left
03:14
cognominal left,
hypolin left
03:16
hypolin joined
03:40
arlinius joined
03:59
djanatyn left
04:01
djanatyn joined
04:12
slayer101_ left
04:14
slayer101_ joined
04:28
ilogger2 joined,
ChanServ sets mode: +v ilogger2,
groky joined
04:30
popl joined
04:31
mathw joined
04:32
noggle joined
|
|||
diakopter waves at jnthn waking up to go to the airport | 04:43 | ||
04:51
MikeFair_ joined
05:11
benabik joined
05:16
adu joined
05:22
SamuraiJack joined
05:29
benabik left
05:30
telex joined
05:37
benabik joined
05:40
rummik joined
06:26
donghongbo joined
06:45
donghongbo left
06:46
adu left
06:47
kaleem joined
07:05
sisar joined
|
|||
moritz | o\ | 07:08 | |
sorear | \o | 07:18 | |
popl | ^o | 07:22 | |
popl sucks | |||
07:50
FROGGS_ joined
08:08
FROGGS_ is now known as FROGGS
|
|||
FROGGS | does the Perl6::Metamodel::MultiDispatcher.vivify_for method is meant to bring the dispatcher to life? I don't get the sense of "vivify"... | 08:14 | |
morning all you happy (still living) perl 6 hacker | 08:15 | ||
08:16
brrt joined
|
|||
timotimo | oh, yes, what kind of world-ending was that? | 08:17 | |
brrt | its not done yet | ||
timotimo | i guess the writers decided there was too much still hanging in the air | ||
and didn't want it to be a total cliffhanger | |||
FROGGS | maybe the release is just late | 08:21 | |
timotimo | well, they've had *lots* of time to prepare | 08:22 | |
a few thousand years, isn't that right? | |||
brrt | its the last time i rely on calendar writers for anything | 08:24 | |
timotimo | no calendar post yet for today? | 08:29 | |
FROGGS | I heard colomon had one... | 08:30 | |
it's somewhere in the backlog | |||
ahh, about 10 hours ago he said he has a draft | 08:31 | ||
08:33
kresike joined
|
|||
kresike | hello all you happy perl6 people | 08:33 | |
brrt | hi kresike | ||
kresike | brrt, o/ | 08:34 | |
timotimo | well, there's still lots of time | ||
08:34
Kharec joined
08:44
ashleydev left,
rjbs left,
nuba joined
08:46
Timbus joined,
sahadev joined,
sivoais joined,
betterworld joined,
Tene joined,
ashleydev joined,
rjbs joined,
sunnavy joined
|
|||
FROGGS | jnthn: you remember the trait_mod:<is> import problem if we import two of them from different modules? | 08:58 | |
jnthn: I might know the solution and I'd like to have a comment: | 08:59 | ||
instead of importing the trait_mod to our lexpad directly, we should instead add a proto and the two trait_mods as dispatchers, right? | |||
moritz | erm, isn't the proto a dispatcher? | 09:03 | |
I'd rephrase | |||
add a proto, and add the candidates from both to-be-imported trait_mod:<is> to the new proto | |||
and make sure not to add the same thing twice over two routes | 09:04 | ||
(not that I'm jnthn or so :-) | |||
hoelzro | morning #perl6 | 09:07 | |
moritz | \o hoelzro | 09:10 | |
FROGGS | thanks moritz | 09:13 | |
so I'm not on the wood way *gg* | 09:14 | ||
09:15
bapa joined
|
|||
moritz | FROGGS: I don't think that idiom works in English :-) | 09:17 | |
phenny: "Holzweg"? | |||
phenny | moritz: "Holzweg" (de to en, translate.google.com) | ||
moritz | "auf dem Holzweg sein" - "to be on the wrong track", blind alley, whatever | 09:18 | |
FROGGS | was a joke actually | ||
moritz | I know, just rambling for the benefit of our non-German speakers | 09:21 | |
FROGGS | r: use Test; say Test.WHO | 09:26 | |
p6eval | rakudo 55dbc0: OUTPUT«("EXPORT" => EXPORT).hash» | ||
FROGGS | r: use Test; say Test::EXPORT.WHO | ||
p6eval | rakudo 55dbc0: OUTPUT«("ALL" => ALL, "DEFAULT" => DEFAULT).hash» | ||
FROGGS | r: use Test; say Test::EXPORT::ALL.WHO | ||
p6eval | rakudo 55dbc0: OUTPUT«("\&plan" => sub plan(Mu ) { ... }, "\&pass" => sub pass(Mu ) { ... }, "\&ok" => sub ok(Mu ) { ... }, "\&nok" => sub nok(Mu ) { ... }, "\&is" => sub is(Mu ) { ... }, "\&isnt" => sub isnt(Mu ) { ... }, "\&is_approx" => sub is_approx(Mu ) { ... }, "\&todo" => sub tod… | ||
FROGGS | hmmm | ||
moritz: is there a module/grammar installed that has multis? | 09:27 | ||
ohh, Test.plan() is a multi | 09:28 | ||
09:30
bapa left
09:32
bapa joined
09:41
Psyche^ joined
09:43
sisar left
|
|||
hoelzro | how do src/stage* relate to each other in NQP? I'm guessing that stage0 is bundled with NQP, and is used to compile NQP itself into stage1? | 09:43 | |
09:43
bapa left
09:44
Psyche^ is now known as Patterner
09:45
bapa joined
|
|||
moritz | correct | 09:45 | |
and then stage1 compiles the sources into stage2 | |||
which is the compiler we install | |||
hoelzro | moritz: the same sources that stage0 compiles into stage1? | 09:46 | |
moritz | hoelzro: yes, there's only one set of sources for nqp | ||
hoelzro | I figured; just checking =) | ||
moritz | and 'make bootstrap-files' copies the stage2 files into stage0 | ||
09:47
dakkar joined
|
|||
hoelzro | ths is probably a stupid question, but why do you have to compile stage1 into stage2, instead of just using stage1? | 09:47 | |
09:49
sdo joined
|
|||
sdo | happy birthday perl | 09:49 | |
moritz | hoelzro: it's not stupid at all, and I'm not sure about the answer | 09:50 | |
hoelzro: I think it's a kind of extra test | |||
hoelzro | I see | ||
moritz | compiling NQP itself is a better test than running the nqp tests (which aren't nearly as comprehensive as Perl 6 test suite) | 09:51 | |
there could also be some bootstrap problems when not having enough stages; I'm not sure about that one though | 09:56 | ||
09:57
SmokeMachine joined,
sdo left
|
|||
hoelzro | well, I think GCC does that; it uses a bootstrap compiler to build itself, and then it uses the fresh compiler to build itself once again | 09:59 | |
probably to make sure new optimizations are present, or something | |||
moritz | GCC also has a build command which makes a binary comparison of the results of the different bootstrapping changes | 10:00 | |
NQP can't do that, because it generates identifiers that have timestamps attached | 10:01 | ||
hoelzro | ah ha | ||
moritz | so the results will never be binary identical | ||
bbkr__ | \o/ Warszawa release | 10:06 | |
hoelzro | so what exactly does "pir::compreg__Ps('QAST').post($source)" do? something like create a new QAST object and assign $source to the post attribute? | 10:12 | |
timotimo | i'm trying to use jnthns optimiser transformation code, but it doesn't seem to register nt^H^Hthe nqp compilr | 10:13 | |
i don't know how to work this | |||
also my ssh is laggy like hell :| | |||
i just perl Configure.pl --gen-nqp=the-correct-commit and it seems to have worked. then i makee'd rakudo and make installed it | |||
what else would i have to do? | 10:14 | ||
moritz | hoelzro: parrot has a global registry for compilers | ||
hoelzro | so 'QAST' is a compiler object name? | ||
moritz | hoelzro: and pir::compreg__Ps($some_string) gets the compiler registered for $some_string | ||
right | |||
and then .post($source) just calls the .post method on it | |||
hoelzro | oh, ok! | ||
moritz | timotimo: that should be enough | 10:15 | |
hoelzro | moritz: thanks for walking me through this =) | ||
moritz | you're welcome | ||
timotimo | oh, excuse me, i meant to say: pir::load_language__Os didn't work | 10:16 | |
it ^H ^H^H^H^H^H^H^H^H^H^H^H^H^H^H^Hcompreg does work | |||
10:16
fgomez joined
|
|||
timotimo | the argument to load_language is NQP, is that correct? or maybe it sokuld be nqp? | 10:16 | |
moritz | probably same case as compreg | ||
but iirc the install paths need some adjustment for load_language to work | 10:17 | ||
timotimo | how it works with nqp instead of NQP,, cool! | 10:18 | |
now let's transform some QASTs :) | |||
10:19
fhelmberger joined
|
|||
timotimo | i would love multiline editing in perl6 :~ | 10:20 | |
i mean in the default rakudo interpreter | |||
10:21
fhelmberger left
10:32
bowtie joined
|
|||
moritz | timotimo: that's a hard one to crack | 10:33 | |
10:35
popl left
10:37
rindolf joined
|
|||
bbkr__ | LWP::Simple fails almost every test with "could not parse headers" on latest Rakudo release | 10:37 | |
moritz | last I looked, LWP::Simple fetched too little data | 10:38 | |
so it tries to parse the headers, but hasn't received them all | 10:39 | ||
so it complains that the headers are incomplete | |||
timotimo | i've copypasted the "visit node" method from Optimizer.pm to get a feel for what the astlooks like for simple cases (code: sprunge.us/CfOC ) but i get a surprising error message: Error while compiling block : Can only use get_how on a SixModelObject | ||
the lowest line on the stack trace is "in any as_post at src/stage2/QAST.nqp:2189" | 10:40 | ||
arnsholt | timotimo: Sounds like you somehow get a native object passed into your code | 10:41 | |
moritz | which is weird, considering that the qast tree isn't changed at all | ||
timotimo | yeah, and it's nqp code, too :| | 10:45 | |
10:46
GlitchMr joined
|
|||
timotimo | if i put all the things into the sub itself, it works | 10:49 | |
oh, perhaps i know what i did wrong | |||
the way the transform sub is called isn't by name | |||
so probably relies on the order of subs in the NQPCODE below | |||
that seems to also mean i can't call transform from within transform :( | 10:56 | ||
makes it kind of hard to experiment properly without recursion - don't really want to implement my own stack. then again, i *could* | 10:57 | ||
11:01
noggle_ joined,
noggle left
|
|||
timotimo | this is all less obvious than i thought it would be, but if seen as a puzzle, i guess it's kind of fun :) | 11:06 | |
r: sub any($x, $y) { say "test"; } say any(1, 2) + 5; | 11:10 | ||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Two terms in a rowat /tmp/GKnFRiiSde:1------> sub any($x, $y) { say "test"; } ⏏say any(1, 2) + 5; expecting any of: postfix infix or meta-infix infix stopper statement end … | ||
FROGGS | it's all fun in case you make at least a tiny progress within hours... I lost the fun a bit hunting a bug for ~25 hours.... now I try again and I see clearer now | ||
timotimo | r: sub any($x, $y) { say "test"; }; say any(1, 2) + 5; | ||
p6eval | rakudo 55dbc0: OUTPUT«test6» | ||
FROGGS | r: say "hello".Int | ||
p6eval | rakudo 55dbc0: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏hello' (indicated by ⏏) in method Int at src/gen/CORE.setting:10298 in method Int at src/gen/CORE.setting:3803 in block at /tmp/Hxs3YYiRQ1:1» | ||
FROGGS | r: say "hello".Num | ||
p6eval | rakudo 55dbc0: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏hello' (indicated by ⏏) in method Num at src/gen/CORE.setting:10299 in method Num at src/gen/CORE.setting:3804 in block at /tmp/a9B7ftCPhZ:1» | ||
FROGGS | r: say "hello".Bool | ||
p6eval | rakudo 55dbc0: OUTPUT«True» | ||
FROGGS | r: say "hello".Bool + 1 | 11:11 | |
p6eval | rakudo 55dbc0: OUTPUT«2» | ||
timotimo | so, in the optimizer, how do i get to figure out if the call to any or | or & or all will give me a junction? | ||
moritz | I guess you need to resolve the actual candidate (if it's not done already), and see if it has a return type annotation | 11:12 | |
(add one if it's missing) | |||
kresike | r: my $a = eval { say "a"; }; say $a; | ||
p6eval | rakudo 55dbc0: OUTPUT«Cannot call 'eval'; none of these signatures match::(Str $code, :lang(:$lang) = { ... }, PseudoStash :context(:$context)) in block at /tmp/d3OQZ1Eizp:1» | ||
timotimo | moritz: do you mean add it to the builtin & and | infix operators? | 11:13 | |
moritz | yes | 11:14 | |
GlitchMr | perl6: if False { say "Hello, world!" } | ||
p6eval | rakudo 55dbc0, niecza v24-12-g8e50362: ( no output ) | ||
timotimo | it seems like self.find_lexical can do most of the work for me in the optimiser | ||
GlitchMr | It's compile time ERROR in Java | ||
moritz | timotimo: note that the optimizer already resolves some multis | 11:15 | |
FROGGS | someone should glue the java thingy to p6eval | ||
timotimo | in this case i don't want to simply inline, i'd like to rewrite the tree itself to move the junction outward | 11:16 | |
moritz | I didn't say "inline", I said "resolve" | ||
well, it might inline too | |||
you can control that with the number in --optimize=1 etc. | |||
wait, does your code run before or after the rakudo optimizer? | 11:17 | ||
11:24
sisar joined
|
|||
timotimo | i've reached the land of a thousand tunnels. also: bad reception | 11:27 | |
that's a good question. i'm not sure. | 11:28 | ||
i would think after | |||
11:30
SamuraiJack left
11:32
SamuraiJack joined
11:38
Chillance joined
11:41
brrt left
|
|||
timotimo | been able to recurse using subs in subs. got a pretty-printed graph now. it will only get more complicated now :| | 11:50 | |
11:55
sisar left
|
|||
moritz | timotimo: have you discovered the QAST dumper already? | 11:55 | |
print($qast.dump) | 11:56 | ||
timotimo | oooh, that's neat | 12:00 | |
but since i have to traverse it anyway, i'll keep the visit method i "built" anyway | |||
moritz | I implemented QAST::Node.dump for debugging the sink context stuff | 12:01 | |
masak | g'day, #perl6. | 12:04 | |
tadzik | heey masak | 12:05 | |
moritz | \o | ||
masak++ # release | |||
timotimo | so, i can probably find the method infix:<|> or infix:<&> from the lexical scope easily, but even if i can figure out that the return type is Junction, i probably can't just call it at compile time, no? | ||
but that would be necessary to programmatically turn 1 | 2 == 1 into 1 == 1 or 2 == 1 | 12:06 | ||
moritz | if the arguments are know at compile time, you can | ||
otherwise not | |||
timotimo | oh, well that's nice :) | ||
12:06
brrt joined
|
|||
moritz | "known at compile time" means you have to know their values | 12:07 | |
ie won't work for my $x = 3; if $x == 42|5 { } | |||
timotimo | so if the & or | has only Wants and for each the compile time value is known (which is the case for my first example here), i can ... just call it? | ||
moritz | erm wait, in my example you can, yes | ||
timotimo | ah, so optimising $x & $y == 5 won't work like that? | 12:08 | |
moritz | correct | ||
timotimo | ah, i can, well that's great :) | ||
moritz | for that, you'd have to identify the &infix:<&> as the one from the setting | ||
timotimo | is there an easy way to do that? | ||
moritz | and duplicate its functiality in the compiler by generating different code for that | 12:09 | |
well, I can think of two ways | |||
timotimo | that's what i wanted to do, yes | ||
moritz | the first is to write a special trait, apply it to the operator, and check it from the compiler | ||
and the second is to look up the symbol in CORE:: | |||
r: say &CORE::infix:<&> | 12:10 | ||
p6eval | rakudo 55dbc0: OUTPUT«sub+{precedence} infix:<&>(*@values) { ... }» | ||
timotimo | is the code to look it up the same in nqp? | ||
nqp: say &CORE::infix:<&> | |||
p6eval | nqp: OUTPUT«Confused at line 2, near "say &CORE:"current instr.: 'panic' pc 13221 (src/stage2/gen/NQPHLL.pir:4682) (src/stage2/gen/NQPHLL.pm:328)» | ||
timotimo | right | ||
moritz | no, you have to find out what it compiles to | ||
timotimo | nqp: say(&CORE::infix:<&>) | 12:11 | |
p6eval | nqp: OUTPUT«Confused at line 2, near "say(&CORE:"current instr.: 'panic' pc 13221 (src/stage2/gen/NQPHLL.pir:4682) (src/stage2/gen/NQPHLL.pm:328)» | ||
timotimo | i suppose the trait thing would be simpler. | ||
moritz | perl6 --target=past -e '&CORE::infix:<&>' | ||
timotimo | would it be enough to just do has $!is_trivial_implementation; and expose that through a getter? or is there a mechanism that's not visible to the user of the rakudo interpreter and such? | 12:12 | |
moritz | doesn't even need to be an attribute | 12:14 | |
it can just mix in the role { method IS_DEFAULT_IMPLEMENTATION { True } } or so | |||
timotimo | that seems good | ||
and then i'd look up i the object has that method and call it to find out if it returns true? | 12:15 | ||
moritz | and then you write if nqp::can($code, 'IS_DEFAULT_IMPLEMENTATION') && $code.IS_DEFAULT_IMPLEMENTATION { ... } | ||
timotimo | oh, clever :) | ||
FROGGS | moritz: in order to add a despatchee to a proto I need it's code, how do I get the code from a symbol name? I'm iterating through $package.WHO... | 12:23 | |
... in Perl6/World.pm that is | 12:24 | ||
12:24
brrt left
|
|||
masak | colomon++'s advent post for today isn't scheduled. | 12:24 | |
is that intentional? | |||
colomon | masak: I'm proof-reading it right now, will post as soon as I'm done. | ||
masak | oki nice | 12:25 | |
just checking :) | |||
colomon | posted | ||
masak | \o/ | 12:26 | |
colomon++ | |||
moritz | colomon++ | ||
colomon | now to make improvements to the testing script. :) | 12:27 | |
timotimo | building a new rakudo/ a new setting is slow on this laptop anyway, but on battery ... oh my :| | ||
masak | anyone mind if I take gist.github.com/4341223 , make a draft out of it in Wordpress, and edit it heavily? | ||
moritz | FROGGS: I... think you have it already | ||
masak | it will be published under my name. if I could, I would publish it under lichtkind's name. but I can always make "Guest post by..." banner or something. | 12:28 | |
moritz | or we can just invite lichtkind to the calendar, and have him publish it | ||
(but please heavily edit it first anyway) | |||
GlitchMr | Rakudo Warszawa :-) | 12:29 | |
masak | moritz: right. question is, should I do the heavy editing in a gist or in Wordpress? | 12:30 | |
why does "the wrong track" translate to "the wood way" in German? :) | 12:31 | ||
moritz | FROGGS: the .WHO is a hash. The keys are the names of the symbols, and the values are the symbols (e.g. Sub objects) themselves | ||
masak: whatever you prefer | |||
FROGGS | hmmm | ||
masak | moritz: I think I *prefer* to do it in Wordpress, because then I have visual feedback as to how the post will end up looking. | 12:32 | |
masak makes it so | |||
moritz | masak: re Holzweg/wood way: de.wikipedia.org/wiki/Auf_dem_Holzweg_sein | ||
masak | excellent. thank you :) | ||
FROGGS | masak: it is about being on a track that is not built completely | 12:33 | |
masak | my heavy editing starts with renaming the article... from "Parsing an IP" to "Day 22 - Parsing an IP address". | ||
moritz | or maybe IPv4 address, unless he covers IPv6 too | ||
masak | he doesn't. good point. | 12:34 | |
I'm confused by the reference "...relevant even in Redmond" in the beginning of the post. does this refer to any particular Microsoft product famously incorporating Perl 5 regexes? | 12:35 | ||
timotimo | i think i may have made "make" run an endless loop when trying to compile my change to the junction class :| | ||
moritz | what did you change? just the trait? | 12:36 | |
timotimo | yes, but i think i did it wrong | 12:37 | |
moritz | did you test it outside the setting first? | ||
that's how I go about such stuff | |||
i.e. write the trait in a normal .pl file, and apply it to a new operator in there | 12:38 | ||
timotimo | i'm doing that now. i went to the toilet in the mean time | 12:39 | |
FROGGS | moar details please^^ | ||
:P | |||
moritz | r: multi sub trait_mod:<is>(Routine $r, :$DEFAULT_IMPLEMENTATION!) { $r does role { method IS_DEFAULT_IMPLEMENTATION() { True } } }; multi f() is DEFAULT_IMPLEMENTATION { }; say &f.?IS_DEFAULT_IMPLEMENTATION | ||
p6eval | rakudo 55dbc0: OUTPUT«Nil» | ||
masak | I see that C# has regular expressions. maybe that's what lichtkind is referring to. | 12:40 | |
does VB have regular expression support? :) | |||
moritz | r: multi sub trait_mod:<is>(Routine:D $r, :$DEFAULT_IMPLEMENTATION!) { say "applying trait"; $r does role { method IS_DEFAULT_IMPLEMENTATION() { True } }; 0 }; multi f() is DEFAULT_IMPLEMENTATION { }; say &f.?IS_DEFAULT_IMPLEMENTATION | ||
p6eval | rakudo 55dbc0: OUTPUT«applying traitNil» | ||
tadzik | I think it does | ||
FROGGS | masak: it has | ||
tadzik | (VB) | ||
moritz | did I misspell it? | ||
r: multi sub trait_mod:<is>(Routine:D $r, :$DEFAULT_IMPLEMENTATION!) { say "applying trait"; $r does role { method IS_DEFAULT_IMPLEMENTATION() { True } }; 0 }; multi f() is DEFAULT_IMPLEMENTATION { }; say &f.?IS_DEFAULT_IMPLEMENTATION | 12:41 | ||
p6eval | rakudo 55dbc0: OUTPUT«applying traitNil» | ||
moritz | r: multi sub trait_mod:<is>(Routine:D $r, :$DEFAULT_IMPLEMENTATION!) { say "applying trait"; $r does role { method IS_DEFAULT_IMPLEMENTATION() { True } }; 0 }; sub f() is DEFAULT_IMPLEMENTATION { }; say &f.?IS_DEFAULT_IMPLEMENTATION | ||
p6eval | rakudo 55dbc0: OUTPUT«applying traitTrue» | ||
moritz | ah | ||
when it's a multi, the role is only mixed into the candidate, but &f is the proto | 12:42 | ||
r: multi sub trait_mod:<is>(Routine:D $r, :$DEFAULT_IMPLEMENTATION!) { say "applying trait"; $r does role { method IS_DEFAULT_IMPLEMENTATION() { True } }; 0 }; multi f() is DEFAULT_IMPLEMENTATION { }; say &f.candidates>>.?IS_DEFAULT_IMPLEMENTATION | |||
p6eval | rakudo 55dbc0: OUTPUT«applying traitTrue» | ||
moritz | there you go. | ||
r: proto f(Int $x) {*}; multi f($) { say 'default' }; f 'foo' | 12:43 | ||
p6eval | rakudo 55dbc0: OUTPUT«default» | ||
moritz | bug! | ||
masak submits rakudobug | |||
moritz | it should check the proto signature, but doesn't | 12:44 | |
masak | right. | 12:45 | |
draft is in place. | |||
saved but not scheduled yet. | |||
will start heavy editing now. | |||
colomon | masak++ | 12:48 | |
colomon just finally got around to running the (improved!) testing script on the Collatz scripts under Niecza, and discovered one of them didn't actually work there. All fixed now, with an updated timings table. | 12:49 | ||
12:58
kaleem left
|
|||
masak | did Perl 5 bring regexes to regular programming to any significant degree? surely it was in sed and ack way before that. | 12:59 | |
I guess Ruby can be said to have regex support *because* Perl 5 has it. | |||
probably Java too, actually. | |||
any other languages you know that have regex support because Perl 5 has it? | 13:00 | ||
oh! JavaScript. | |||
it even has them with the same slash-delimiter syntax. | |||
moritz | aye | 13:01 | |
GlitchMr | Almost any language has regexpes because of Perl 5. | 13:02 | |
rindolf | masak: I think in awk regexes are quoted as strings and used by functions (except in case of the line/rule-matchine). | ||
GlitchMr | Perl 5 made regexpes popular. | ||
masak | GlitchMr: yes, but what evidence supports that claim? | ||
GlitchMr | JavaScript specification | ||
rindolf | Java didn't get built-in regex support until JDK-1.4.0 | 13:03 | |
GlitchMr | es5.github.com/#x15.10 | ||
masak | GlitchMr: I already gave JavaScript as a data point above. | ||
I'm looking for more data points. | |||
timotimo | moritz, i did the trait completely diffeently, just adding a role. i guess ill better copy your code from above | 13:04 | |
GlitchMr | docs.python.org/2/library/re.html | ||
"This module provides regular expression matching operations similar to those found in Perl." | |||
timotimo | can the trait go into junction.pl? | ||
GlitchMr | Besides, almost any language with regular expressions has lookaheads (?= ) and (?! ) | ||
Those were first in Perl 5. | 13:05 | ||
Similarly, (?: ) | |||
masak | lichtkind: try to avoid phrasings like "that's how it's spelled now", which induces a temporal sequencing between Perl 5 and Perl 6 that does not accord with observable reality. ;) | ||
13:05
Chillance left,
Celelibi joined
|
|||
masak | GlitchMr: yes, but which languages? | 13:05 | |
moritz | masak: the term PCRE attests to Perl's influence on regexes | ||
masak | Python too, good. | ||
13:05
Chillance joined
|
|||
GlitchMr | Practically anything that was written after Perl had regular expressions. | 13:06 | |
masak | I'm looking for indirect influences, too. which languages/technologies use PCRE, then? | ||
FROGGS | PHP | ||
masak | ooh, yes. | ||
FROGGS++ | |||
GlitchMr | PCRE is used in PHP and R. | ||
moritz | UNIX | ||
man 3 pcre | |||
GlitchMr | That was late addition. | ||
UNIX doesn't use Perl regular expressions. | 13:07 | ||
Besides, man 3 pcre isn't even part of UNIX | |||
It's part of PCRE library | |||
13:07
rjbs left
13:10
MayDaniel joined
|
|||
GlitchMr | If you are going to tell me that grep can use --perl-regexp option, this is GNU option, not UNIX. | 13:10 | |
masak | and GNU is not UNIX ;) | 13:11 | |
moritz | $ $ apt-cache rdepends libpcre3|wc -l | ||
243 | |||
masak | moritz: wow :) | ||
moritz | that's just dependencies on one particular implementation | ||
aaand I think just direct dependencies, not recursive oes | 13:12 | ||
GlitchMr | glitchmr@strawberry ~/Pobrane> apt-cache rdepends libpcre3 | wc -l | ||
moritz | *ones | ||
masak | lichtkind says that regex syntax is "less special", compared to the rest of the language? what does he mean? does he mean that regex syntax is more general than the main slang? because I don't think it is. | ||
GlitchMr | 246 | ||
Interesting | |||
masak takes a short walk | |||
GlitchMr | apt-cache rdepends seems to include the programs I don't have installed... makes sense. | 13:13 | |
moritz | I just tried aptitude purge libpcre3 | ||
it wants to deintall 722 packages | |||
masak | :D | ||
moritz | *deinstall | ||
and that's just from the ones I have installed on my desktop | 13:14 | ||
masak | I think what lichtkind wanted to say was either "less special syntax compared to Perl 5's regexes" or "less special compared to all the other changes that happened between Perl 5 and Perl 6". | ||
I don't know which one. | 13:15 | ||
moritz | I guess "more regular than the Perl 5 regexes" | ||
masak | aye. | ||
going with that one. | |||
GlitchMr | gist.github.com/4352748 | 13:16 | |
Remove the system! | |||
That's like almost every package in my system | 13:17 | ||
masak | ok, so PCRE is important. I get it :) | ||
so far I have Ruby, Python, Java, JavaScript, VB, and PHP among the languages. | 13:18 | ||
still not so many. | |||
13:18
am0c_ joined
|
|||
GlitchMr | Does m:P5// in Perl 6 count? | 13:19 | |
masak | "Before you get scared too much..." -- so, a little bit scared is what we're aiming for here? :P | ||
GlitchMr: oh, you're implying Perl 6 was inspired by Perl 5 regexes? :P | |||
GlitchMr | Also, I think that .NET should be on this list. Both VB.NET and C#. | ||
masak | yes, I guess both m:P5 and the Perl 6 regexes count, in a way. | ||
masak takes a short walk | |||
moritz | masak: exim, apache, ngrep, lighttpd, i3-wm, drizzle, nmap, grep, zsh # just a few popular programs that depend on libpcre3 | 13:20 | |
GlitchMr | GNU grep | 13:21 | |
The UNIX grep doesn't use PCRE | |||
GNU grep depends on PCRE in only one specific case - when using --perl-regexp option. | |||
moritz | what is "The UNIX grep" exactly? | ||
GlitchMr | It's grep in UNIX | 13:22 | |
tadzik | what's "UNIX"? | ||
GlitchMr | duckduckgo.com/?q=UNIX | ||
moritz | in which UNIX? | ||
GlitchMr | That's interesting question... | ||
tadzik | UNIX is a trademark of AT&T or something, I don't think there even is "The UNIX" which is used anywhere | 13:23 | |
moritz | just like there's no "the C compiler" or "the shell" or "the food" | ||
GlitchMr | But whatever UNIX it would be, Linux is not UNIX. | 13:24 | |
moritz | why not? because there's no UNIX in the name? | ||
tadzik | no, because that's what the name says :P | ||
moritz | I'd say linux is a UNIX flavor, just as gcc is a flavor of C compiler | ||
cedrvint thought Linux was short for "Le Unix" :) | |||
tadzik | :D | 13:25 | |
FROGGS | UNIX is a brand, Unix is not | ||
GlitchMr | Linux isn't POSIX compatible. | ||
moritz | it's not? | ||
tadzik | news | ||
13:26
am0c_ is now known as am0c
|
|||
moritz | en.wikipedia.org/wiki/POSIX lists GNU/Linux als "Mostly compliant" | 13:26 | |
FROGGS | BSD's and Mac OS X are Unixes, linux is not | ||
it's just System V compatible | |||
moritz | so, what does a system need to be to be a UNIX? | ||
erm sorry, a Unix | 13:27 | ||
tadzik | I think an appropriate anwser is "who cares?" :P | ||
FROGGS | it needs to have parts of the original kernel | ||
cedrvint | tadzik++ | ||
tadzik | does it have cat and grep? Then it's unix enough for me | ||
GlitchMr | The problem is that Linux doesn't have cat or grep. | 13:28 | |
cedrvint | no cat but a penguin | ||
moritz thinks we are far into trolling territory right now | |||
tadzik | yep | ||
soon someone will start enforcing the GNU/Linux meme | |||
GlitchMr | GNU/Linux does have cat or grep. Linux doesn't. | 13:29 | |
BinGOs | Gun-Oo | ||
flussence | .oO( surely you mean GNU/Linux/Xorg/Mozilla/Google/Qt/Oracle/... ) |
13:30 | |
GlitchMr | I don't have Google or Oracle software on my computer. | ||
flussence | I don't have GNU on my router, but it still runs Linux :) | 13:31 | |
tadzik | "I see that you're using glibc? Yeah! Start calling your system differently from now on!" | ||
cedrvint | GlitchMr: as far as I know Oracle contributes to the Linux kernel (FS). | ||
GlitchMr | Or perhaps you mean Google Linux. You know, en.wikipedia.org/wiki/Android_(operating_system) | ||
Except Google Linux doesn't have grep. But as far I can see, it does have cat. | 13:32 | ||
FROGGS | I have pics of my cat on my android too | ||
FROGGS .oO( and fwiw my cat can grab ) | 13:33 | ||
13:37
arafatkamaal joined
|
|||
GlitchMr | Also, www.johndcook.com/regex.html | 13:38 | |
Perl regexpes in Microsoft PowerShell | |||
FROGGS | all .Net things can use regexes | ||
since you just have to load a specific dll, like in VB | |||
moritz | even niecza :-) | 13:39 | |
GlitchMr | How can I use .NET in Niecza? | ||
tadzik | look at examples | ||
there's Gtk tetris and other stuff there | |||
GlitchMr | Just wondering, what is the difference between MAIN.exe and Niecza.exe? | 13:40 | |
Woodi_ | hey, hey :) | ||
colomon | GlitchMr: basically you just import the symbols and Niecza handles the rest. | 13:41 | |
colomon did not know there was a MAIN.exe | |||
GlitchMr | Let's say I want to use System.Text.RegularExpressions.Regex | ||
Is it possible in Niecza? | |||
Woodi_ | looks afternoon is nice after sto^H^H^Hworld-end :) | 13:42 | |
advocating Perl influence in grep is quite fun :) | 13:44 | ||
colomon | GlitchMr: seriously, look at the examples | ||
it will probably be faster for you to try it out than it would be to explain it. | 13:45 | ||
GlitchMr | Where can I see some examples? | ||
colomon | niecza/examples/gtk-* | ||
GlitchMr | github.com/sorear/niecza/blob/mast...watcher.pl | 13:47 | |
Oh, that... | |||
add_ is for += overloading? | |||
colomon | I don't know, that's moderately magical and it's been a long time since i looked at it. | 13:48 | |
but I think it's a .NET thing, not Niecza-specific. | 13:49 | ||
13:49
avar joined,
avar left,
avar joined
13:50
rindolf left
|
|||
colomon | yeah, .add_Changed is the same as .Changed += | 13:51 | |
Woodi_ | Plan9 probably forked 'regexp' meaning or at least is trying to make step forward from *nix world... swtch.com/~rsc/regexp/regexp1.html but mayve this link is so 2007's ? | 13:52 | |
tadzik | plan9 even has its own C standard librar | ||
GlitchMr | niecza> CLR::<System.Text.RegularExpressions.Regex,System,PublicKeyToken=b77a5c561934e089>.new('ab?c').Match('<ac>') | ||
ac | |||
Seems to work. | |||
But why doing this has to be so ugly? PublicKeyToken? | 13:53 | ||
FROGGS | dunno, mabye its a microsoft policy | ||
(doing ugly stuff) | 13:54 | ||
colomon | GlitchMr: if you look at, say, examples/gtk-clock.pl, you'll see how to factor the code so that all the ugliness is contained and the main code looks beautiful. | 13:55 | |
13:55
SamuraiJack left
|
|||
GlitchMr | Also, how can I use static methods, like Regex.Escape()? | 13:56 | |
13:57
shlomif joined
14:04
shlomif is now known as rindolf
|
|||
colomon | GlitchMr: I'm not sure. | 14:05 | |
might be as simple as <System.Text.RegularExpressions.Regex,System,PublicKeyToken=b77a5c561934e089>.Escape | 14:06 | ||
GlitchMr | Thanks. | 14:07 | |
It worked. | |||
niecza> CLR::<System.Text.RegularExpressions.Regex,System,PublicKeyToken=b77a5c561934e089>.Escape('[](){}') | |||
\[]\(\)\{} | |||
Interesting. Regex.Escape() doesn't escape ] or }. | 14:08 | ||
14:09
Kharec left
|
|||
moritz | not needed in normal regexes; you only need to escape ] inside charclasses | 14:09 | |
14:10
Kharec joined
|
|||
GlitchMr | Too bad. | 14:11 | |
If it would escape ] and -, it would be useful for character classes. | |||
But perhaps it's good. preg_quote() in PHP also escapes characters like =, !, <, >, :. And doesn't escape -. | 14:12 | ||
Not surprised. It's PHP. Everything is broken. | |||
14:16
PacoAir joined
|
|||
[Coke] enjoys a subtitled film on his day off. | 14:23 | ||
(french zombie movie) | 14:26 | ||
Ulti | outside of the core language is there a list of modules that are wanted for perl6? | 14:28 | |
like a list of priority ports from perl5 or something? | |||
moritz | there was an old wiki page with such a list, but I don't know where it is, and neither whether it's up to date | 14:29 | |
masak is back, having stocked his coffers with turkey, chocolate, and stout | |||
Ulti | I'll take a google then :) | ||
masak | this should last me through Christmas :) | ||
Ulti | there is a list on github for most wanted modules | 14:30 | |
probably not going to touch SSL though ;P | |||
14:30
dayangkun joined
|
|||
masak | Woodi_: I don't understand -- are you saying swtch.com/~rsc/regexp/regexp1.html is related to Plan9 somehow? | 14:33 | |
by the way, that URL has a long and proud history on this channel :) | 14:34 | ||
arafatkamaal | Hi masak | 14:35 | |
what exactly is the difference between print and .print? | |||
GlitchMr | print is function | 14:36 | |
.print is method | |||
timotimo | moritz: you were suggesting to create DEFAULT_IMPLEMENTATION, but i see there's already a role "default" which has a method "default()" that just returns true | ||
should i just use that one instead? | |||
arafatkamaal | perl6 -e 'my @a=1...10;for @a {print}' | ||
perl6 -e 'my @a=1...10;for @a {.print}' | |||
give two different outputs | |||
FROGGS | perl6: my @a=1...10;for @a {.print} | 14:37 | |
GlitchMr | Unlike Perl 5, print doesn't have default implicit argument. | ||
p6eval | rakudo 55dbc0, niecza v24-12-g8e50362: OUTPUT«12345678910» | ||
GlitchMr | Use .print for that | ||
FROGGS | perl6: my @a=1...10;for @a {print} | ||
p6eval | niecza v24-12-g8e50362: OUTPUT«===SORRY!===Unsupported use of bare 'print'; in Perl 6 please use .print if you meant $_, or use an explicit invocant or argument at /tmp/jRsfWwoO5T line 1:------> my @a=1...10;for @a {print⏏}Unhandled exception: C… | ||
..rakudo 55dbc0: ( no output ) | |||
FROGGS | perl6: my @a=1...10;for @a { print($_) } | ||
arafatkamaal | rakudo allows print | ||
p6eval | rakudo 55dbc0, niecza v24-12-g8e50362: OUTPUT«12345678910» | ||
arafatkamaal | but prints nothing | ||
GlitchMr | arafatkamaal: NYI | ||
arafatkamaal | actually my question was something else | 14:38 | |
GlitchMr | arafatkamaal: This error is Not Yet Implemented. | ||
arafatkamaal | ok | ||
actually I have a lot of Perl 5 habits | |||
tadzik | print() is probably equivalent to print('') at the moment | ||
GlitchMr | Errors are supposed to find every possible Perl 5 habit. | 14:39 | |
But sadly, most of those aren't yet implemented in Rakudo. | |||
arafatkamaal | I was expecting while(<FILEHANDLE>){chomp;print} to somehow work | ||
GlitchMr | Nope | ||
<FILEHANDLE> is one element list. | |||
Containing 'FILEHANDLE' | 14:40 | ||
<> is new syntax for qw// (qw still works, by the way). | |||
masak | it's `for $fh.lines { .say }` nowadays :) | ||
arafatkamaal: hi, btw :) | |||
arafatkamaal | :) | ||
masak | r: for lines { my $firstword = .words[0]; say $firstword.uc } | ||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Missing blockat /tmp/tC3vGA8Ui_:1------> rstword = .words[0]; say $firstword.uc }⏏<EOL> expecting any of: method arguments postfix infix or meta-infix infix stopper stat… | ||
GlitchMr | std: while <FILEHANDLE> { chomp; print } | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===Unsupported use of bare 'chomp'; in Perl 6 please use .chomp if you meant $_, or use an explicit invocant or argument at /tmp/jQq0nUonVB line 1:------> while <FILEHANDLE> { chomp⏏; print }Unsupported use of bare 'pr… | ||
masak | oh right. | ||
r: for lines() { my $firstword = .words[0]; say $firstword.uc } | 14:41 | ||
p6eval | rakudo 55dbc0: OUTPUT«LANDLANDLANDHEIMATVOLK,VIELGERÜHMTESVIELGERÜHMTESHEISSLIEGSTEINEMHASTHOHERVIELGEPRÜFTESVIELGEPRÜFTESMUTIGFREIARBEITSFROHEINIGVATERLAND,VIELGELIEBTESVIELGELIEBTES» | ||
masak | (the input is the Austrian national hymn) | ||
r: for lines() { my $firstword = .words[* - 1]; say $firstword.lc } | |||
p6eval | rakudo 55dbc0: OUTPUT«strome,dome,zukunftsreich!söhne,schöne,österreich,österreich!Cannot use negative index -1 on List in method <anon> at src/gen/CORE.setting:10307 in at src/gen/Metamodel.pm:2404 in any find_method_fallback at src/gen/Metamodel.pm:2392 in any find_met… | ||
masak | heh. | ||
GlitchMr | Cannot use negative index -1 on List | ||
I guess it's empty line | |||
arafatkamaal | Any reason why implicit printing of $_ was removed from Perl 6? Eg: perl6 -e 'my @a=1...10;for @a {say}' - Doesn't really print $_ automagically? | 14:42 | |
masak | r: for lines() { next unless .words; my $firstword = .words[* - 1]; say $firstword.lc } | ||
GlitchMr | Because of "VIELGERÜHMTESHEISS" | ||
p6eval | rakudo 55dbc0: OUTPUT«strome,dome,zukunftsreich!söhne,schöne,österreich,österreich!umstritteninmitten,gleich.ahnentagengetragen,österreich,österreich!zeiten,schreiten,hoffnungsreich.brüderchören,schwören,österreich,österreich!»… | ||
GlitchMr | arafatkamaal: Because it was too clever. | ||
masak | arafatkamaal: yes, there's a reason. | ||
GlitchMr | But you can use .say; | ||
It's close enough. | |||
masak | arafatkamaal: we try to eliminate the cases where you have to learn a lot of "special" behavior by heart. | ||
arafatkamaal | ok | 14:43 | |
masak | arafatkamaal: and some subroutines defaulting to $_ counts as that kind of special behavior. | ||
as GlitchMr points out, we have the more general mechanism of doing .say instead of $_.say now. | |||
GlitchMr | Still, regular expressions default to $_ . | ||
masak | yes, but they're not subs :) | ||
GlitchMr | So you can still use .say if /word/; or something like that. | 14:44 | |
masak | for loops and given statements also default to $_. | ||
arafatkamaal | perl6 -e 'my @a=1...10;for @a{.say}' doesn't work but... | ||
hoelzro | what exactly is CORE.setting? the default environment that Perl 6 programs run in? | ||
arafatkamaal | perl6 -e 'my @a=1...10;for @a {.say}' does work | ||
masak | arafatkamaal: yes, that's the next thing :) | ||
GlitchMr | arafatkamaal: Whitespace | ||
masak | arafatkamaal: we're a bit more touchy about whitespace in Perl 6. | ||
GlitchMr | $a{'b'} means key 'b' in hash $a. | ||
masak | arafatkamaal: and there are reasons for that as well. | ||
arafatkamaal | :) obviously im missing years of discussions | 14:45 | |
masak | :) | ||
GlitchMr | Without doing that, omitting parenthesis would be impossible in if. | ||
masak | arafatkamaal: [] alone means array, but [] directly after something means positional indexing. | ||
arafatkamaal: {} alone means block or hash, but {} directly after something means named indexing. | |||
arafatkamaal: <> alone means qw list, but <> directly after something means autoquoted named indexing. | 14:46 | ||
after a while, a pattern emerges: we care a lot about whitespace directly after terms. | |||
GlitchMr | if $a{'a'}{.say} \n { say 42 } # is .say hash element or not... | ||
masak | so Perl 6 simply cares about all of that kind of whitespace. | ||
arafatkamaal: () alone means an isolated statement (not expression, surprisingly), but () dreictly after something means a function call with a parameter list. | 14:47 | ||
FROGGS | so if( 123 ) is a function call | ||
masak | right. | ||
since we care about the whitespace after terms, we could even define infix operators that would otherwise collide with postfix operators, but don't. | 14:48 | ||
arafatkamaal | It was quite surprising for me to learn for @a -> $b is also a function call! | ||
masak | r: sub infix:<++>($l, $r) { $l + $r + 1 }; say 4 ++ 5 | ||
p6eval | rakudo 55dbc0: OUTPUT«10» | ||
masak | arafatkamaal: in a sense, yes. | ||
we lean quite heavily on blocks. see S04 :) | |||
arafatkamaal | is there a .for? | ||
masak | yes. | ||
it's called .map :P | |||
arafatkamaal | !!! | ||
masak | literally, 'for' and '.map' use the same mechanism in Perl 6. | 14:49 | |
GlitchMr | gist.github.com/4353237 | ||
arafatkamaal | So basically it all comes down to reading specs and working out how they all make sense together | ||
GlitchMr | arafatkamaal: consider code I've pasted | ||
masak | it's just that 'for' tends to be eager by default, since it's often used in sink (=void) context. whereas .map tends to be lazy by default, since it often isn't. | ||
GlitchMr | This is one of examples why Perl 6 needs to use whitespace | ||
masak | arafatkamaal: yes, read specs, but keep coming back here and talking about it. it helps. | ||
arafatkamaal: also, keep writing code to try stuff. that really helps. | 14:50 | ||
arafatkamaal | ok | ||
timotimo | what is "is default" used for inside rakudo? can i use it to mark infix:<&> and infix:<|> as the "default implementation"? | ||
masak | arafatkamaal: we're always very grateful when people come back with feedback. so don't be afraid you're bothering the people here with questions. we love it :) | ||
GlitchMr | timotimo: "is default" is used in case more than one multi-dispatch rule matches. | ||
When used, "is default" is most important method. | 14:51 | ||
Usually it isn't needed, as Perl 6 tries to be clever about that. | |||
masak | arafatkamaal: oh! and because we care about whitespace after terms, you can do a few cool new things inside qq strings. here, let me demonstrate. | ||
r: my @array = 1, 2, 3, 4; say "The third element is @array[2], you know." | |||
p6eval | rakudo 55dbc0: OUTPUT«The third element is 3, you know.» | ||
masak | r: my %hash = foo => 1, bar => 2; say "Go to the bar and get %hash<bar> :)" | ||
p6eval | rakudo 55dbc0: OUTPUT«Go to the bar and get 2 :)» | ||
GlitchMr | Actually, this is one of those places where Perl 5 cared about whitespace. | ||
masak | r: say "You can even call &uc('functions')!" | 14:52 | |
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Unable to parse expression in double quotes; couldn't find final '"'at /tmp/tX0em_ouwH:1------> ay "You can even call &uc('functions')!"⏏<EOL> expecting any of: postfix double quotes»… | ||
14:52
stopbit joined
|
|||
timotimo | in that case, i shall create a trait DEFAULT_IMPLEMENTATION (shouted to convey this is internal magic, of course) | 14:52 | |
GlitchMr | eval: my @a = 1; print "Hello, $a[0]."; | ||
buubot_backup | GlitchMr: Hello, 1.1 | ||
GlitchMr | eval: my @a = 1; "Hello, $a[0]."; | ||
buubot_backup | GlitchMr: Hello, 1. | ||
GlitchMr | eval: my @a = 1; "Hello, $a [0]."; | ||
buubot_backup | GlitchMr: Hello, [0]. | ||
masak | hm, what happened there? | ||
r: say "You can even call &uc('functions')" | |||
p6eval | rakudo 55dbc0: OUTPUT«You can even call FUNCTIONS» | ||
arafatkamaal | yes | ||
masak submits rakudobug | |||
GlitchMr | I usually use {uc 'functions'} for that, it's less ugly. | 14:54 | |
masak | sometimes, discussing things uncovers bugs in the implementations ;) | ||
GlitchMr | r: say "You can even call {uc 'functions | ||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Unable to parse expression in single quotes; couldn't find final "'"at /tmp/v5N6Zk_hCZ:1------> say "You can even call {uc 'functions⏏<EOL> expecting any of: argument list prefix or term … | ||
GlitchMr | rn: say "You can even call {uc 'functions'}!" | ||
p6eval | rakudo 55dbc0, niecza v24-12-g8e50362: OUTPUT«You can even call FUNCTIONS!» | ||
masak | not as often as before, though. | ||
GlitchMr: yes, whatever floats your goat. actually, I would probably do that too, in most cases. | |||
r: my @a = 1, 2, 3; say "@a[1]!" | 14:55 | ||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Unable to parse expression in double quotes; couldn't find final '"'at /tmp/tseZolTZEq:1------> my @a = 1, 2, 3; say "@a[1]!"⏏<EOL> expecting any of: postfix double quotes» | ||
masak | r: my @a = 1, 2, 3; say "@a!" | ||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Unable to parse expression in double quotes; couldn't find final '"'at /tmp/eXWz0iwRYh:1------> my @a = 1, 2, 3; say "@a!"⏏<EOL> expecting any of: postfix double quotes» | ||
timotimo | i don't quite know what i'm doing wrong - i added a multi trait_mod:<is>(Routine:D $r, :$DEFAULT_IMPLEMENTATION!) to src/core/traits.pm and put sub infix:<|>(**@values) is DEFAULT_IMPLEMENTATION into src/core/Junction.pm, but i get Could not find sub &infix:<does> when trying to compile it :| | 14:59 | |
masak | timotimo: could you nopaste your patch? | 15:00 | |
timotimo | sure | 15:01 | |
sprunge.us/NgOc | |||
r: say True + True + False | |||
p6eval | rakudo 55dbc0: OUTPUT«2» | ||
timotimo | oh, that's neat, i *am* going to be able to turn junctions involving ^ into simpler logical formulas | 15:02 | |
arafatkamaal | This one is from the spec | ||
perl6 -e 'my @primesquares = (do $_ if .is-prime for 1..100) »**» 2;say @primesquares' | |||
15:03
FROGGS left
|
|||
arafatkamaal | what exactly is »**» , how do you even type that on a normal keyboard? | 15:03 | |
timotimo | you can also type >>**>> if you want | ||
it applies ** to all list items on the left and the right (kind of like a zip would), but will make the list on the right as long as needed | 15:04 | ||
(because on the right side there's only one 2, but you want as many 2s as you have primes on the left) | |||
arafatkamaal | wasn't 'do' supposed to execute any block in a loop only once? | ||
timotimo | isn't that what FIRST is for? | 15:05 | |
r: { FIRST { say "first!"; } say "blubb" } for ^5; | |||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Two terms in a rowat /tmp/XA_ir6Qago:1------> { FIRST { say "first!"; } ⏏say "blubb" } for ^5; expecting any of: postfix infix or meta-infix infix stopper statement end … | ||
timotimo | r: { FIRST { say "first!"; }; say "blubb" } for ^5; | ||
p6eval | rakudo 55dbc0: OUTPUT«first!blubbblubbblubbblubbblubb» | ||
timotimo | hm, i wonder ... | 15:07 | |
arafatkamaal | One last question till I get further practice | ||
timotimo | r: { say "a"; FIRST { say "first!"; };} for ^5; | ||
p6eval | rakudo 55dbc0: OUTPUT«first!aaaaa» | ||
arafatkamaal | where exactly can I read about all the .functions eg: .say, .is-prime ? | 15:08 | |
timotimo | if you want to, you can look into the rakudo source, because rakudo is for the most part implemented in perl6 | 15:09 | |
other than that, see the synopses i guess? perlcabal.org/syn/ | |||
arafatkamaal | thanks | 15:10 | |
timotimo | you're welcome. and have fun with perl6! :) | ||
masak | arafatkamaal: in Perl 6, 'do' simply turns a statement into an expression. | 15:11 | |
nothing to do with loops. | |||
arafatkamaal: if you're using vim, you cn type » as Ctrl+K > > | |||
arafatkamaal: if you're on Emacs, there's a wonderful plugin called LEIM with all sorts of nifty input methods. | 15:12 | ||
(if you're on some other editor, get a better editor) :P | |||
arafatkamaal: also check out doc.perl6.org/ -- it's not complete, but what's there is really nice. | |||
moritz++ | 15:13 | ||
timotimo | or a better keyboard layout. otherwise, most linuces come with proper Xcompose mappings | ||
masak | yeah. | ||
in general, look beyond what keys you have on your keyboard, and let software remap things for you. | |||
timotimo | masak: did you catch my diff? i can't make heads nor tails of it | 15:16 | |
masak | timotimo: url? | ||
timotimo | sprunge.us/NgOc | ||
masak looks | 15:17 | ||
$r does role { method DEFAULT_IMPLEMENTATION() { True } } | |||
trivially, this is where the error happens. | |||
but I also don't see why. | |||
timotimo | yeah, in the other is infixes it's done the same way | 15:18 | |
i don't have to stub anything in junction.pm or something? | |||
masak | maybe it's a circularity saw problem. | ||
maybe &infix:<does> isn't defined at the time you try to use it. | 15:19 | ||
jnthn or pmichaud would know, but they're not here right now. | |||
beyond that, I'm a little dismayed at putting a new traid into the setting like that. it looks like a kind of super-default, is that right? | 15:20 | ||
I'm assuming the spec doesn't mention it? | |||
is the intention to start putting DEFAULT_IMPLEMENTATION on anything in the setting from now on? | |||
(because I don't think that's a very good idea) | |||
what's the scope of your change? :) | |||
timotimo | i was hoping there would be a way to make it only visible internally inside rakudo | 15:21 | |
in order to rewrite simple-ish junctions in the AST into logic formulas (think $x & $y == -1|0|1) i need to make sure those & and | are the "default implementation" | |||
masak | sounds like you want AST manipulation on the level of macros, not to change the setting. YMMV. | 15:22 | |
timotimo | moritz suggested an alternative, which is to lookup if the infix:<&> or what have you comes from ::CORE, but i didn't see how to do that at all | 15:23 | |
masak | I like that better. | ||
timotimo | the AST would have been manipulated in the optimiser, the trait is just for the analysis | ||
15:26
bot48 joined
15:32
kaleem joined
|
|||
timotimo | not having a lot of success here :P - i guess i should try doing something simpler instead. like add more typed exceptions or close more old bugs =_= | 15:36 | |
arafatkamaal | Is there a way to know all methods inside a class? | 15:39 | |
like say perl6 -e 'my %h,say %h.allmethods' | 15:40 | ||
should print all methods callable on %h | |||
timotimo | r: say {a=>1,b=>2).^methods | 15:41 | |
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Unable to parse expression in block; couldn't find final '}'at /tmp/eqJJZKh649:1------> say {a=>1,b=>2⏏).^methods expecting any of: postfix infix or meta-infix infix stopper sta… | ||
timotimo | r: say {a=>1, b=>2}.^methods | ||
p6eval | rakudo 55dbc0: OUTPUT«new bind_key STORE_AT_KEY STORE delete push PARAMETERIZE_TYPE at_key perl elems exists iterator list keys kv values pairs invert at_key STORE_AT_KEY Capture FLATTENABLE_LIST FLATTENABLE_HASH fmt hash of Bool ACCEPTS perl elems infinite item fmt Int Num chrs Numeric… | ||
timotimo | .^ is a call to the metaclass | 15:42 | |
arafatkamaal | ok | 15:43 | |
15:44
arlinius joined
15:45
skids joined
|
|||
timotimo | r: Hash.new.HOW.^methods | 15:49 | |
p6eval | rakudo 55dbc0: ( no output ) | ||
timotimo | r: say Hash.new.HOW.^methods | ||
p6eval | rakudo 55dbc0: OUTPUT«No such method 'gist' for invocant of type 'NQPRoutine' in method gist at src/gen/CORE.setting:5038 in sub say at src/gen/CORE.setting:7488 in block at /tmp/21u807fF0G:1» | ||
timotimo | i wonder if anyone would be mad at me for implementing this ... | 15:50 | |
15:50
kaleem left
|
|||
moritz | nobody would be mad at you for implementing stuff that's missing | 15:52 | |
timotimo: re infix does and circularity: that's a problem because infix:<does> is defined rather alte in the setting | 15:56 | ||
timotimo: but you can take a look at how infix:<does> does the mixing in, and duplicate that | |||
stuff like that is often done in the setting | |||
15:59
am0c left
16:00
kaleem joined
|
|||
masak | today's autopun: "How many SEO experts do you need to exchange a light bulb, lightbulb, light bulb, energy saving light bulb, blowjob, xxx, free porn" | 16:00 | |
(courtesy of mjd, and mst's quote collection) | 16:01 | ||
16:01
FROGGS joined
|
|||
moritz | :-) | 16:02 | |
16:02
dpk joined,
mtk joined,
dpk left
|
|||
Woodi_ | masak: I am pretty sure that url is related to plan9 becouse Thompson algo is very related to p9 QED... I didn't know that uri have history here, however algo description looks similiar to recent jnthn++ work (which is why I posted link...) | 16:02 | |
arafatkamaal | perl6 -e 'my @a=0...Inf;for @a {.say if .is-prime}' | 16:03 | |
how would you rewrite this using map? | |||
not I have used Inf, so don't run evalbot on it | |||
moritz | evalbot has a protection against stuff like that | 16:04 | |
anway, I'd write it as | |||
kresike | bye folks | ||
arafatkamaal | typo: note | ||
16:04
kresike left
|
|||
moritz | r: .say for (0..*).grep: *.is-prime | 16:04 | |
p6eval | rakudo 55dbc0: OUTPUT«(timeout)» | ||
Woodi_ | btw. just found Ken Thompson patented Thompson algo what probably explains why it was so *un*adopted in last decades... | ||
arafatkamaal | but thats using grep | 16:05 | |
16:07
kaleem left
16:10
odoacre joined
|
|||
rindolf | Woodi_: which one? | 16:12 | |
masak: heh, nice joke. | 16:13 | ||
masak | Woodi_: there's an interesting relationship between that URL and Perl 6's LTM mechanism. | 16:16 | |
r: (0..Inf).map: { .say if .is-prime } | 16:17 | ||
p6eval | rakudo 55dbc0: ( no output ) | ||
[Coke] | I am not a fan of borat at all, and even I laughed at this: twitter.com/DEVOPS_BORAT/status/28...6682757120 | ||
masak | r: eager (0..Inf).map: { .say if .is-prime } | ||
arafatkamaal: like that. | |||
p6eval | rakudo 55dbc0: OUTPUT«(timeout)2357111317192329313741434753596167717379838997101103107109113127131137139149151157163167173179181191193197199211223227229233239241251257263269271277281283293307311313317331337347349353xE2x90 | ||
masak | [Coke]: it's because it's funny-true :) | 16:18 | |
16:21
silug joined
16:23
thou joined
|
|||
arafatkamaal | Good night folks | 16:23 | |
masak | arafatkamaal: 'night | ||
16:23
arafatkamaal left
|
|||
[Coke] | bueños sueños. | 16:24 | |
[Coke] over ñ'd that. | |||
masak .oO( spamusement.com/index.php/comics/view/20 ) | 16:26 | ||
that website still has the ability to incapacitate me with silly laughter. :) | 16:27 | ||
hoelzro waves goodbye to productivity | 16:33 | ||
masak | hahaha spamusement.com/index.php/comics/view/117 | 16:37 | |
16:40
thou left
16:44
thou joined
16:45
benabik left
16:48
isBEKaml joined
|
|||
masak | tadzik would like this one: spamusement.com/index.php/comics/view/185 :) | 16:49 | |
isBEKaml | hola, #perl6! | 16:51 | |
masak: (backloggin') I guess the Redmond reference in lichtkind's post was about powershell. They were said to be heavily inspired by perl scripting. | 16:52 | ||
masak: and you're right about Java and ruby bringing Perl regexes to mainstream. PCRE libs played their part too. | 16:53 | ||
timotimo | if i want to use the nqp i just changed (but have not committed) for building my rakudo, do i have to do Configure.pl at all? or is it enough to make in nqp/ and the make in rakudo? | 16:54 | |
tadzik | :D | ||
isBEKaml | I have now taken to the habit of backlogging and adding stuff. I'm not even sure if it's a good thing. :D | 16:55 | |
masak | isBEKaml: it's a good thing. thanks for adding stuff. | ||
isBEKaml | tadzik: You're our meme repository! :P | ||
tadzik | am I? :) | ||
timotimo | so sad that spamusement won't make new content :( | 16:56 | |
isBEKaml | tadzik: Ja. | ||
masak: Danke. | |||
masak | tadzik: pandas, zubrs, rage faces. yes, you are :) | 16:57 | |
hm, meant żubry, of course :) | |||
tadzik | (: | ||
17:11
xinming joined
|
|||
timotimo | i was going to implement a .gist for NQPRoutine, so that you can .HOW.^methods, but i have no idea what i'm doing and now i don't know how to do what i guess is correct ... which would be to return something generated with nqp::repr_box_str. | 17:13 | |
17:13
Kharec left
17:16
dakkar left
|
|||
masak | "so you don't move your eyeballs back and forth before you can understand it" -- heh, I understand what lichtkind means. something like "you don't need to read to the end of the regex before you know the conditions under which it should be read". :) | 17:16 | |
masak rewrites | |||
17:16
kaare_ joined
|
|||
masak | r: my $str = "1 23 456 78.9"; $str ~~ m:g/(\d+)/; say $0.^name | 17:18 | |
p6eval | rakudo 55dbc0: OUTPUT«Any» | ||
masak | r: my $str = "1 23 456 78.9"; $str ~~ m:g/(\d+)/; say $/.^name | ||
p6eval | rakudo 55dbc0: OUTPUT«Any» | ||
masak | I'm... not sure I want to include this example in the blog post. it doesn't seem to work. | ||
I wouldn't do m:g anyway, I'd do .comb | 17:19 | ||
masak rewrites to use .comb instead. | |||
17:23
buubot_backup joined
|
|||
masak | oh, .comb shows up a few paragraphs earlier. | 17:25 | |
is there support in the spec that $str ~~ m:g/(\d+)/ means the same as $str.comb(/\d+/) ? | 17:26 | ||
moritz | r: $_ = '1 23 456 78.9'; .say for m:g/(\d+)/ | ||
p6eval | rakudo 55dbc0: OUTPUT«「1」 0 => 「1」「23」 0 => 「23」「456」 0 => 「456」「78」 0 => 「78」「9」 0 => 「9」» | ||
moritz | you can use that as an example | ||
masak | moritz++ | 17:27 | |
r: $_ = '1 23 456 78.9'; .Str.say for m:g/(\d+)/ | |||
p6eval | rakudo 55dbc0: OUTPUT«123456789» | ||
masak | r: $_ = '1 23 456 78.9'; say .Str for m:g/(\d+)/ | ||
p6eval | rakudo 55dbc0: OUTPUT«123456789» | ||
moritz | there are two possiblities for m:g// | 17:28 | |
the first is to return a List | |||
then $str ~~ m:g/.../ matches the string against the List, and (nearly) always fails the smart-match | |||
or it returns a Match | 17:29 | ||
which might or might not flatten, but $/ can never flatten, because it starts with a $ | |||
masak | each time we get back to ~~ and m//, it seems to me that we've painted us into an unfortunate design corner there. | ||
moritz | r: .say for 'abc' ~~ /(.)(.)(.)/ | 17:30 | |
p6eval | rakudo 55dbc0: OUTPUT«「abc」 0 => 「a」 1 => 「b」 2 => 「c」» | ||
masak | where we have some expectations, and the spec ends up saying "no, that simply can't work". I wonder why. | ||
moritz | r: say .Str for 'abc' ~~ /(.)(.)(.)/ | ||
p6eval | rakudo 55dbc0: OUTPUT«abc» | ||
moritz | masak: I've blogged about that :-) | ||
lemme look up the link for you | |||
masak: perlgeek.de/blog-en/perl-6/three-fu...match.html | |||
TimToady++ wants to fix it with his OKness proposal | 17:31 | ||
masak | nod, and nod. | ||
moritz | but I still think orthogonalizing matching and topicalization is the way to go | 17:32 | |
though I can't provide a good solution either | |||
masak | the OKness proposal still rubs me the wrong way, for some reason. it's like we're putting dualvars on *everything*. | ||
and calling the top type "Mu" feels like a small break from tradition compared to the OKness proposal. | 17:33 | ||
moritz | speaking of which | ||
now that we don't smart-match against Mu all the time, can we rename it to Object again? | |||
the name Mu is an FAQ, and it's wrongly huffmanized | 17:34 | ||
masak | \o/ | 17:35 | |
I'm all for it. | |||
moritz | .oO( you think this is Mu today ) |
17:36 | |
is that an autopun? | 17:37 | ||
masak | r: /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ | ||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Unsupported use of {N,M} as general quantifier; in Perl 6 please use ** N..M (or ** N..*)at /tmp/PMGekASt8e:1------> /(\d{1,3}⏏)\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/» | ||
masak | moritz: doesn't feel so autopunny... :) | ||
moritz | masak: it doesn't, but it kinda uses the thing it mentions (or fails to mention?) | 17:38 | |
masak | just a calque, I think. | ||
who are Bob and Tom in lichtkind's article? someone I should know about? | 17:43 | ||
timotimo | isn't it normally tim and ... who was that other guy? | 17:44 | |
tim and al. | |||
masak | oh good, so it isn't just me. | ||
masak rewrites | |||
timotimo | (from the tv show 'home improvement') | ||
masak | aye. I've seen it. | 17:46 | |
not excellent TV, but kinda cute and wholesome. | |||
timotimo | i agree. it was more than good enough for me back then, but i was quite young, too | 17:47 | |
17:47
Kharec joined
|
|||
masak | (for a moment, I was wondering if "Bob" was another lichtkind reference to Redmond. but I don't believe there was ever a Microsoft Tom) :P | 17:48 | |
timotimo | :D | 17:49 | |
17:51
GlitchMr left
|
|||
moritz | Bob the Visual Studio Builder assistent? | 17:52 | |
17:52
GlitchMr joined
|
|||
masak | :P | 17:54 | |
r: say .Str for "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32." ~~ m/ (\d ** 1..3) ** 4 % '.' / | 17:56 | ||
p6eval | rakudo 55dbc0: OUTPUT«127.0.0.1» | ||
masak | r: say .Str for "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32." ~~ m:g/ (\d ** 1..3) ** 4 % '.' / | ||
p6eval | rakudo 55dbc0: OUTPUT«False» | ||
masak | r: $_ = "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32."; say .Str for m:g/ (\d ** 1..3) ** 4 % '.' / | 17:57 | |
p6eval | rakudo 55dbc0: OUTPUT«127.0.0.1173.194.32.32» | ||
masak | r: $_ = "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32."; say @().perl for m:g/ (\d ** 1..3) ** 4 % '.' / | ||
p6eval | rakudo 55dbc0: OUTPUT«().list().list» | ||
masak | r: $_ = "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32."; say @($/).perl for m:g/ (\d ** 1..3) ** 4 % '.' / | ||
p6eval | rakudo 55dbc0: OUTPUT«(Any,).list(Any,).list» | ||
masak | hm. | ||
timotimo | so is regex matching in perl6 surprisingly non-cool? | ||
masak | r: $_ = "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32."; say $/.list.perl for m:g/ (\d ** 1..3) ** 4 % '.' / | ||
p6eval | rakudo 55dbc0: OUTPUT«(Any,).list(Any,).list» | ||
masak | r: $_ = "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32."; say .list.perl for m:g/ (\d ** 1..3) ** 4 % '.' / | 17:58 | |
p6eval | rakudo 55dbc0: OUTPUT«((Match.new(orig => "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32.", from => 19, to => 22, ast => Any, list => ().list, hash => EnumMap.new()), Match.new(orig => "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.… | ||
masak | ah, yes. | ||
r: $_ = "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32."; say .list>>.Str.perl for m:g/ (\d ** 1..3) ** 4 % '.' / | |||
p6eval | rakudo 55dbc0: OUTPUT«("127", "0", "0", "1")("173", "194", "32", "32")» | ||
isBEKaml | timotimo: Regex is not Cool. | ||
timotimo | that would explain it! | ||
masak | r: $_ = "So, I told him, go 127.0.0.1! But he got lost and knocked on 173.194.32.32."; say .>>Str.perl for m:g/ (\d ** 1..3) ** 4 % '.' / | ||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Confusedat /tmp/7u2EVzmqCa:1------> st and knocked on 173.194.32.32."; say .⏏>>Str.perl for m:g/ (\d ** 1..3) ** 4 %  expecting any of: dotty method or postfix» | ||
timotimo | why was Regex not specced to be Cool? | ||
masak | because Cool is all about the interconvertability between string, numeric and boolean values from Perl 5. | 18:01 | |
and a Regex isn't a string, a number, or a boolean. | 18:02 | ||
isBEKaml | yeah, what masak said. Cool is a mixed bag for all operations, it contains numeric, string and other stuff. | 18:04 | |
now that I look at Regex.pm, I see some pir stuff. I thought we got rid of them in favour of nqp? (flaky memory again, I guess :) | 18:05 | ||
masak | lichtkind post reviewed, rewritten, and scheduled for tomorrow. | 18:08 | |
feel free to log into Wordpress and review the result :) | |||
"people making apocalypse jokes like there's no tomorrow" -- this is quite likely to be an autopun, however :) | 18:10 | ||
oh dear; at this rate I'll have material for a second lightning talk... :P | |||
isBEKaml | that's going to get old real quick! :P | ||
masak | isBEKaml: autopuns have an amazing ability to renew themselves. they don't wear out so much. | 18:11 | |
which is odd because they all build on *exactly* the same principle. | |||
18:11
SamuraiJack joined
|
|||
masak blames our brains | 18:12 | ||
masak heads out into the winter for the second time today | |||
isBEKaml | masak: well, I was just talking about how we pull jokes around events and all the fun is lost after they're past. | ||
masak: winter in .se? must be night-long days! :D | 18:13 | ||
masak | isBEKaml: I swear, I haven't seen the sun for weeks. I hope it's doing some good for the rest of planet. :) | 18:14 | |
isBEKaml | masak: Well, I can't say it's any good if the earth is tilted so far back. :P | 18:17 | |
isBEKaml should stop making bad jokes | 18:18 | ||
18:37
kaleem joined
18:45
isBEKaml left
18:50
SamuraiJack left
18:52
Tabrenus joined
|
|||
masak | greetings, Tabrenus. | 18:55 | |
Tabrenus | hello masak | ||
masak | are you new here? I don't recall seeing you around. | 18:56 | |
if so, welcome. :) | |||
Tabrenus | thanks | 18:57 | |
18:58
wooden_ left
|
|||
masak | nr: say "the implementations say 'welcome, {my $name = 'Tabrenus'}', too :)" | 19:03 | |
p6eval | niecza v24-12-g8e50362: OUTPUT«Potential difficulties: $name is declared but not used at /tmp/iyrhu2OB10 line 1:------> "the implementations say 'welcome, {my ⏏$name = 'Tabrenus'}', too :)"the implementations say 'welcome, Tabrenus', too :)» | ||
..rakudo 55dbc0: OUTPUT«the implementations say 'welcome, Tabrenus', too :)» | |||
masak is not so fond of the 'declared but not used' warning :/ | |||
diakopter neither | 19:04 | ||
hoelzro | is that niecza-specific? | ||
masak | hoelzro: no, it's from STD and only Niecza implements it. | 19:05 | |
FROGGS | I like the C way there, emitting these warnings only if I do -Wunused | ||
hoelzro | can someone come up with a snippet of code that would result in a "Confused" | ||
19:05
wooden joined
|
|||
hoelzro | FROGGS: agreed. | 19:05 | |
19:05
wooden left,
wooden joined,
Tabrenus left
|
|||
flussence | r: sub infix:<_> { * }; 5_() | 19:06 | |
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Confusedat /tmp/0TCJFtVs7d:1------> sub infix:<_> { * }; 5⏏_() expecting any of: whitespace» | ||
flussence | useless, but does what you asked for :) | ||
19:07
rhr joined
|
|||
hoelzro | hmm | 19:07 | |
thanks! | |||
19:17
popl joined
|
|||
sahadev | r: my @a = 1..5; my @b = 'a' .. 'e'; my @c = \@a, \@b; my @d = [\@a, \@b]; say "\@c[0] = @c[0], \@d[0] = @d[0]" | 19:43 | |
p6eval | rakudo 55dbc0: OUTPUT«@c[0] = 1 2 3 4 5, @d[0] = 1 2 3 4 5 a b c d e» | ||
19:44
fgomez left
|
|||
tomgj | Kind of a back to front question coming up. Suppose I am specifying the API of a Perl 6 module. A class contains "has Str $.foo is rw". Is this best documented in the API doc as "has Str $.foo is rw"? If one wanted to document the same API in terms of method(s), what would they be? | 19:46 | |
19:47
REPLeffect joined
|
|||
tomgj | "method foo() is rw returns Str" ? | 19:47 | |
19:56
fgomez joined
|
|||
masak | tomgj: in a sense, $.foo is a method. | 19:58 | |
slavik1 | getter/setter? | 20:00 | |
20:03
SmokeMachine left
|
|||
timotimo | so, there must be some kind of wrapping that i would need to do if i want to make a method of an NQPRoutine not only callable from perl6 code (which already seems to work), but also wrap the string I want to return so that it is a sensible object for perl6/rakudo. what could that be? repr_box_str perhaps? from looking at its signature, i couldn't figure out how to correctly call it :( | 20:04 | |
moritz | nqp::p6box_s($nqp_str) | ||
timotimo | well, that was simpler than i thought :) | ||
masak | (it's as if NQP was made for this kind of thing) :P | 20:06 | |
20:07
fgomez left
|
|||
FROGGS | coincidence! | 20:07 | |
tomgj | slavik1: AIUI the method created by "has" as written above returns an lvalue, so it doesn't really fit what I understand by getter/setter | 20:08 | |
masak: okay, but I'm really trying to ask about best practices for api documentation. I was wondering whether it would be expected generally that the consumer of an api, reading the documentation, would understand the "has ..." one as meaning the "method ..." one. But actually "method foo() is rw returns Str" is starting to look less messy now anyway, so I think I'll just stick with that. | 20:12 | ||
slavik1 | tomgj: Perl6 automatically generates getter/setter methods, in java you would have to write them manually. If you call $object.foo("hello"), this will set the value of $.foo to "hello", likewise, $object.foo() returns the value stored by $.foo | 20:13 | |
has Str $.foo is rw < this talks about an attribute/member, not method. method gets generated automagically. that is my udnerstanding of how Perl6 (and Moose in Perl5) functions | 20:14 | ||
masak | tomgj: yes, the consensus seems to be to put things in code when you can and in documentation only if you must. | ||
slavik1 | listen to masak, his IQ has as many digits as the value of my IQ ... >.> | 20:15 | |
TimToady | no, that's not how it works; you'd have to assign to $object.foo | ||
slavik1 | TimToady: so it's $object.foo = "hello";? | ||
wasn't away that it was changed ... | 20:16 | ||
TimToady | it was never the other way | ||
slavik1 | oh | ||
diakopter | rn: class A { has $.foo = $!foo; method boo { $!foo } }; say A.new.boo | ||
p6eval | rakudo 55dbc0, niecza v24-12-g8e50362: OUTPUT«Any()» | ||
TimToady | arguments to a method are only used to help establish the identity of the lvalue | ||
so the signature of the "setter" is identical to the "getter" | 20:17 | ||
that is, we don't distinguish setter from getter | |||
slavik1 | right | ||
TimToady | a thing either returns an lvalue or it doesn't | 20:18 | |
masak | rn: class A { has $!x; has $!y; method foo($_) is rw { when 'x' { $!x }; $!y } }; given A.new { .foo('x') = 5; say .foo('x') } | ||
p6eval | rakudo 55dbc0: OUTPUT«Cannot assign to a non-container in block at /tmp/QuevMOdD2B:1» | ||
..niecza v24-12-g8e50362: OUTPUT«5» | |||
masak | niecza++ | ||
slavik1 | I recall reading somewhere that the idea was that if you call $object.foo() without any args, it acts as a getter, if you give it stuff, it acts as a setter ... | ||
TimToady | in the RFCs maybe, never after that | ||
tomgj | TimToady: good. Would you be able to confirm for me that I am correct in saying that the signature of the method generated when I write "has Str $.foo" is "method foo () returns Str is rw" | ||
20:19
sjohnson joined
|
|||
timotimo | so, uh, i've tried calling p6box_s, but i'm getting "could not find sub &p6box_s". perhaps i'm working at the wrong level? i just added method gist() { p6box_s($!do); } to my knowhow NQPRoutine { ... } in src/core/NQPRoutine.pm. | 20:19 | |
TimToady | there is no 'is rw' unless you put one on the "has" | ||
20:20
fgomez joined
|
|||
tomgj | oh dear, I thought declaring a method rw meant it returned an lvalue. Back to experiments / reading for a while then.. | 20:20 | |
timotimo | return-rw is there for you | ||
20:20
skids left
|
|||
TimToady | you asked if it was equivalent to the "has", and it isn't | 20:20 | |
it would be equivalent if you put "is rw" on the "has" | 20:21 | ||
tomgj | ah, whoops, I missed off "is rw" from the "has" clause the most recent time I wrote it. Thanks for confirming that with it, it is equivalent. | 20:23 | |
20:24
telex left
|
|||
tomgj | masak: regarding code vs documentation, the comment seems to rather gloss over the distinction between interfaces, which should be specified properly, and implementation. | 20:25 | |
masak | still no takers on perl6dvent slot #24? | ||
20:25
Kharec_ joined
|
|||
slavik1 | huh? | 20:25 | |
what is that? | 20:26 | ||
masak | tomgj: well, I'd consider signature, return type, and names to be part of the interface. | ||
tomgj: and anything inside of the method body to be part of the implementation. | |||
20:26
telex joined
|
|||
masak | slavik1: it's the remaining empty slot in the Perl 6 Advent Calendar this year. | 20:26 | |
slavik1 | to do what, though? | 20:27 | |
tomgj | masak: sure - part of. | ||
slavik1 | I have no idea what that calendar is for ... | ||
tomgj | I think I understand what you meant better now | ||
slavik1 | :( | ||
masak | slavik1: the calendar is here: perl6advent.wordpress.com/ | 20:28 | |
20:28
Kharec left
|
|||
masak | slavik1: it's the fourth year we're doing it, so I'm a little surprised you've missed it until now. :) | 20:28 | |
slavik1 | yeah | ||
I haven't been followng Perl6 much in the last 4 years due to wr0k | |||
masak | *nod* | 20:29 | |
slavik1 | I am not smart enough to have something cool about Perl6 :( | ||
20:30
colomon joined
20:32
jfried joined
|
|||
masak | the 24th slot is usually something special. in 2009, pmichaud++ wrote about STD.pm6. in 2010, TimToady++ wrote about positive trolling. | 20:34 | |
timotimo | moritz: did you read my little line about p6box_s above? this is the diff: sprunge.us/VgfE | 20:36 | |
20:42
kaleem left
|
|||
moritz | timotimo: nqp::p6box_s is only availble in rakudo, not in nqp | 20:42 | |
and it's wrong for NQP to return Perl 6 types anyway | 20:44 | ||
20:47
sahadev1 joined
|
|||
timotimo | oh. so i'll have to do magic in rakudo, not in nqp | 20:48 | |
moritz | www.piumarta.com/software/maru/ # interesting | 20:49 | |
20:49
Kharec_ left,
sahadev1 left
20:50
sahadev left,
sahadev1 joined
20:51
cognominal joined,
fgomez left
20:52
snearch joined
|
|||
masak | I believe I've seen Maru once before. a really nice proof-of-concept. | 20:53 | |
20:57
cognominal left
20:59
fgomez joined
|
|||
timotimo | grepping through all of perl6+nqp+parrot shows only appearances of NQPRoutine in nqp and nothing in src/Perl6/Metamodel stands out as something that would explain how NQPRoutine gets into rakudo. where should i look instead? | 20:59 | |
21:01
isBEKaml joined
21:02
sahadev1 left
|
|||
moritz | nqp: sub f() { }; say(f.name) | 21:05 | |
p6eval | nqp: OUTPUT«Method 'name' not found for invocant of class 'NQPMu'current instr.: '' pc 93 ((file unknown):58) (/tmp/tBaLSZy_xE:1)» | ||
moritz | nqp: sub &f() { }; say(&f) | ||
p6eval | nqp: OUTPUT«Use of undeclared variable '&f' at line 2, near ")"current instr.: 'panic' pc 13221 (src/stage2/gen/NQPHLL.pir:4682) (src/stage2/gen/NQPHLL.pm:328)» | ||
moritz | timotimo: I think that subroutines and/or methods in NQP are compiled to NQPRoutine | 21:06 | |
timotimo: and since the metamodel is written in NQP, you get that once you go a level more meta than you usually do | |||
timotimo | in that case i don't know how to cross the metas sufficiently to return a perl6 string from the gist method a NQPRoutine has (or rather: doesn't have yet) | 21:08 | |
21:08
GlitchMr left
|
|||
moritz | timotimo: the answer is probably rather magical, in terms of MOP metacircularity or so | 21:14 | |
and not easily figured out | |||
moritz tests the qast-sink-1 branch one more time, and hopes to merge it Very Soon[tm] | 21:16 | ||
timotimo | OK, then i'll look for another thing to break my teeth off with | 21:17 | |
besides fixing more old bugs that are "closable with tests", what comparably simple things could i try? | 21:18 | ||
moritz | timotimo: I'm not sure how easy it is, but I'd love to see better recognition of illegal Null Regexes in Rakudo | 21:19 | |
STD does it very well | |||
std: /a | | b/ | |||
p6eval | std a8bc48f: OUTPUT«===SORRY!===Null pattern not allowed at /tmp/fmNpJ9Tfmg line 1:------> /a | ⏏| b/Parse failedFAILED 00:00 41m» | ||
moritz | r: / a | | b / | ||
p6eval | rakudo 55dbc0: ( no output ) | ||
moritz | nr: / a | | b / | ||
p6eval | rakudo 55dbc0: ( no output ) | ||
..niecza v24-12-g8e50362: OUTPUT«===SORRY!===Null pattern not allowed at /tmp/EjTpknugZS line 1:------> / a | ⏏| b /Parse failed» | |||
timotimo | std: / a | ( | ) | b / | 21:20 | |
p6eval | std a8bc48f: OUTPUT«===SORRY!===Null pattern not allowed at /tmp/ukHS6BTAoN line 1:------> / a | ( | ⏏) | b /Parse failedFAILED 00:00 41m» | ||
timotimo | this is something that would be done in Actions.pm? | ||
don't think it could be done in Grammar already | 21:21 | ||
moritz | it's done in the grammar | 21:22 | |
note that grammars have the same <term> <infix> <term> structures as mainline code | 21:23 | ||
and two terms in a row and two operators in a row are also detected in the grammar | |||
timotimo | a | | b / <- this would be two operators in a row, right? | 21:24 | |
moritz | you can "just" search STD.pm6 for "Null pattern" and "Null regex", and try to port the error detection to rakudo. Such things are often, but not always, not too hard | ||
correct | |||
timotimo | i'll see what i can do. i'll be focusing on src/Perl6/Grammar.pm::Perl6::RegexGrammar, is that right? | 21:26 | |
moritz | right | 21:27 | |
and possibly also on the regex grammar in NQP | |||
timotimo opens QRegex::P6Regex::Grammar in a split, too | |||
moritz | from which Perl6::RegexGrammar inherits | ||
21:27
ifim joined
|
|||
timotimo | it seems like nqp/src/stage1/gen/NQPP6Regex.pm is the one i want to look at, is that right? | 21:30 | |
or maybe stage2? | |||
moritz | no, everything in directories with 'gen' in the name is generated | ||
src/QRegex/P6Regex/Grammar.pm iirc | |||
and src/stage* is also generated (though the .pm files are often just copies) | |||
timotimo | ah, yes | 21:31 | |
moritz | .nqp, not .pm | ||
timotimo | that's about 1000 lines less than the generated one. but nothing important is missing? | ||
moritz | I guess the generated one also contains the regex compiler and actions | 21:32 | |
21:32
isBEKaml left
|
|||
timotimo | do you wish to get a structured exception class to go with it? (in case i get anything done in the first place ;) ) | 21:32 | |
moritz | there's already one for it | ||
timotimo | perfect! | ||
moritz | just not triggered often enough | 21:33 | |
timotimo | er, there's only 3 relevant occurences of "Null" in STD.pm6. am i missing something? | 21:35 | |
dalek | Heuristic branch merge: pushed 35 commits to rakudo/nom by moritz | 21:36 | |
flussence | yay | ||
timotimo | great, moritz++ :) | ||
flussence | moritz++ # kitchen sink | ||
21:38
Tabrenus joined
|
|||
timotimo | er, will i be allowed to add "invalid null pattern" errors to nqp as well? intuition says: yes | 21:38 | |
moritz | yes | 21:39 | |
21:42
stevan_ joined
|
|||
FROGGS | boys and girls: I almost-fixed the merge-import bug! | 21:50 | |
moritz | \o/ | 21:51 | |
timotimo | is there no alternative spelling of $¢? | ||
FROGGS | phenny: tell jnthn I have a patch that allows one to import multis from two different modules (like the trait_mod:<is>), but one thing remains open: the dump of the list of dispatchers is incomplete, even if all dispatchers work | ||
phenny | FROGGS: I'll pass that on when jnthn is around. | ||
FROGGS | thanks phenny | 21:52 | |
moritz | timotimo: $/.CUSRSOR | ||
FROGGS: incomplete how? | |||
are the ones from the setting missing? | |||
FROGGS | I have Foo.pm that exports multi trait_mod:<is> ( Routine $r, :$foo!), and Bar.pm that does that with :$bar! | 21:53 | |
timotimo | r: / / | ||
p6eval | rakudo 55dbc0: OUTPUT«===SORRY!===Null regex not allowedat /tmp/JQ1osiSPjh:1------> / /⏏<EOL>» | ||
timotimo | at least that still works in my local copy :) | ||
FROGGS | you can use both traits, but if you use a unkown trait it will just print the core ones plus bar, but not foo | 21:54 | |
I would like to push that to a branch, and it would be just awesome if I had commit bit | 21:56 | ||
FROGGS makes puppy eyes | |||
dalek | kudo/nom: 0199241 | jnthn++ | src/ (2 files): Make "my $a; { $a; my $a } an error. This commit doesn't break any tests and actually makes a TODO test pass. However, it's a bit close to release to include it now, so it goes in a branch for now and can be merged afterwards. |
22:03 | |
kudo/nom: 3c3f780 | moritz++ | src/ (2 files): Merge remote branch 'origin/outer-bound' into nom |
|||
22:03
tcpr1347 joined
22:04
skids joined
|
|||
dalek | kudo/nom: c8de2eb | moritz++ | docs/ChangeLog: update ChangeLog for outer-bound branch merge |
22:04 | |
timotimo | the next release is already going to be nice :P | 22:05 | |
moritz | phenny: tell jnthn YOU MAKED BRANCH outer-bound BUT I MERGED IT KXTHXBY | ||
phenny | moritz: I'll pass that on when jnthn is around. | ||
22:09
Tabrenus left
22:10
colomon left
22:11
whiteknight joined
|
|||
timotimo | i'll go to bed and see if i can get anything working tomorrow. i've copied over a rule from STD to nqp, but it doesn't seem to have changed anything. i'll need to look more closely and understand more, i s'pose. | 22:16 | |
22:16
cognominal joined
22:17
colomon joined
|
|||
masak | 'night, #perl6 | 22:38 | |
colomon | \o | 22:40 | |
22:42
snearch left
22:52
fgomez left
23:00
cognominal left
|
|||
rindolf | masak: good night. | 23:03 | |
23:12
kaare_ left
23:15
popl left
23:19
cognominal joined
23:26
fgomez joined
23:29
stopbit left
23:33
xinming left,
rummik left,
rummik joined
23:35
xinming joined,
cognominal left
23:40
cognominal joined
23:41
rurban joined
23:45
rurban left
23:47
rurban_ joined
23:49
rurban_ is now known as rurban,
cognominal left
|