pugscode.org/ | nopaste: sial.org/pbot/perl6 | pugs: [~] <m oo se> (or rakudo:, kp6:, smop: etc.) || We do Haskell, too | > reverse . show $ foldl1 (*) [1..4] | irclog: irc.pugscode.org/
Set by TimToady on 25 January 2008.
Tene So, for statements will set $_ as a formal parameter of a block if there are no other params. Do any other statements do that? 00:33
I guess I'll check the failures.
Eevee while..?
Limbic_Region map
probably the same ones as in perl 5
unless defined differently
Tene Right now pblock is setting it on every block.
Eevee oh 00:34
given
Tene Hm. I guess for now I'll just make pblock only set it on blocks that don't have anything.
Slightly less broken, but still not ideal. 00:35
Eevee gather
oh, no
Tene Then I'll post to the list.
Eevee nevermind
CATCH 00:36
what OO support does rakudo have atm? 00:46
Tene Eevee: a decent amount. Look at some of Jonathan's use.perl posts
Eevee ah, not too bad 00:48
Tene Oh, that didn't work. Hm. 00:48
Eevee pokes around t/spec/S12 and t/oo 00:50
Eevee how do custom accessors work? S12 says they can be written but doesn't say how, unless they're just lvalue methods that touch explicitly-declared private attributes 01:00
allbery_b an accessor shouldn't return an lvalue. the whole point of an accessor is to hide the internals; an lvalue would be exporting an internal representation 01:51
you must use a mutator to modify the internal state
Eevee well then what's that look like 01:54
allbery_b "accessor" is a concept, not a language construct. just write a function which does whatever. 02:00
auto-generated accessors are a language construct; the accessor is an rvalue reflection of a private variable, the mutator sets the private variable. 02:01
if you choose to write your own, you can write whatever you want.
the idea here is that if your internal replresentation chanegs somehow, your accesssor and mutator will hide the details while exporting the same interface, you just make them do whatever is necessary to produce (resp. consume) the externally visible value 02:02
trivial example: you have an object which among other things has a length expressed in inches. later on you want it to store in millimeters. 02:03
Eevee no, I grok encapsulation; I just mean is there any way for "$obj.foo = 42;" to run code I wrote (presumably some multi method set_foo(Int $foo)) 02:04
allbery_b so you replace the default accessor and mutator with versions that convert between inches and millimeters, and possibly export a new interface using millimeters if you so choose
I'm pretty sure there is (that's a mutator) but I don't know what the current details are 02:05
(any language definition types around?) 02:06
Eevee I only threw out lvalue because it's the ony way to do it in p5 and the only thing I can see in the synopses so far that would work; I know it's discouraged 02:07
allbery_b partial answer is you declare the method with the "is rw" attribute (I'd guessed that). what you do inside it doesn't seem to be specced. 02:27
(from what I've seen so far, I *think* you need to return an object with a STORE method which is invoked upon assignment.( 02:28
allbery_b hrm. I wonder. perhaps the topic of an "is rw" is the asisgned value. 02:33
where's @Larry when you need them? :)
Tene allbery_b: the answer is in S06 03:23
allbery_b Eevee, listiening?
Tene I ran into it when looking for the answer to my "where is $_ set as a parameter" question. 03:24
Eevee buh 03:25
yes
allbery_b hm, I read therough S06 and didn't quite get beyond "is rw" --- what does that *mean*?
i.e. what does the code have to do in such a thing? I saw something about objects with FETCH and STORE methods... 03:26
in a different context
Eevee perlcabal.org/syn/S06.html#Lvalue_subroutines ?
Tene Yeah, you have to return a proxy object
lambdabot Title: S06
Eevee okay so that IS what you do
Tene Eevee: yes
allbery_b that seems rather annoying 03:27
especially compareds to ruby's def foo= ... 03:28
Eevee and/or a bit hacky
allbery_b Eevee: it's not hacky, in fact it's a very clean way to do it. 03:33
unfortunately it's the kind of "clean" that makes you do a lot of gruntwork to *make* it cleasn
(i.e.. the proxy object) 03:34
Eevee from the perspective of the code I have to write, though, it strikes me as a bit low-level
allbery_b this is the kind of thing that makes me throw up my hands and start writing in Haskell, where if I have to do something ugly like that at least I can abstract it away into a higher order function :)
Eevee bumping up against internals rather than a cheerfully-exposed language feature 03:35
allbery_b pretty much, yes
Tene Eevee: what would you prefer?
Eevee Tene: I have no idea; I usually hope I can keep babbling long enough to figure out something better
but you interrupted me!
allbery_b actually, given what sounds a lot like a snide remark about set_foo() style mutators at the end of that section, I think either we have to strike that remark or come up with something better than explicit proxies 03:36
Eevee (sorry, PBP; apparently everyone just hates set_*/get_*) 03:39
allbery_b hm, sorry, the snide-off isn't in that section
Eevee hum. python has its property() which isn't a whole lot better
Tene Okay, this passes all the tests, but it seems even worse... 03:40
Patterner everyone hates it because nobody has a better name :) 03:42
Eevee Tene: so does a Proxy's STORE stick the rhs of the assignment into the argument list? i.e., syntactically, "$proxy = whatever" is identical to "$proxy.STORE(whatever)" 03:45
(where 'whatever' is not necessarily a single expression; that was a terrible way to write that) 03:46
allbery_b sounds off to p6l
Eevee I ask way too many questions 8) 03:47
gah, getting late and I'm being pressured to go run errands; bbl 03:48
allbery_b Eevee: I would expect it to be in the parameter list, yes, like any other method (FETCH and STORE are more or less the same as with tied scalars in perl5)
Eevee so I could do $obj.foo = 1, 2, $object_of_some_specific_type, bar => 3; ? 03:49
mncharity pmurias: re =~, yeah, regex handling is one of the few real elf bogosities at the moment. adverbial modifiers weren' 04:08
t parsing until recently, so regexen... are just being silently slid from p6 into p6. towards the top of the todo list. 04:09
*p6 into p5
Tene Okay, this works in rakudo now: 04:27
for @a { say $^a }
In line with: "A bare closure without placeholder arguments that uses $_ (either explicitly or implicitly) is treated as though $_ were a formal parameter"
Tene It doesn't specify what happens if $_ is used in a closure with placeholder arguments, or if things are different in non-bare blocks. 04:28
mncharity vixey: moritz_: So, you tried elf. Was it what you hoped it would be? 05:28
mncharity looks for feedback.
Tene perl6: my @a = <a b c d>; for @a { say $^a } 05:33
exp_evalbot kp6: OUTPUT[no method 'APPLY' in Class 'Undef'␤ at compiled/perl5-kp6-mp6/lib/KindaPerl6/Runtime/Perl5/MOP.pm line 345␤ KindaPerl6::Runtime::Perl5::MOP::__ANON__('HASH(0x824bec4)', 'APPLY', 'HASH(0x8e510c8)') called at compiled/perl5-kp6-mp6/lib/KindaPerl6/Runtime/Perl5/MOP.pm line 169␤
..main::DISPATCH('HASH(0x824bec4)', 'APPLY', 'HASH(0x8e510c8)') ca...
..pugs: OUTPUT[a␤b␤c␤d␤]
..rakudo: OUTPUT[a␤b␤c␤d␤]
Tene perl6: my @a = <a b c d>; for @a { say $_ }
exp_evalbot kp6: OUTPUT[no method 'APPLY' in Class 'Undef'␤ at compiled/perl5-kp6-mp6/lib/KindaPerl6/Runtime/Perl5/MOP.pm line 345␤ KindaPerl6::Runtime::Perl5::MOP::__ANON__('HASH(0x824be94)', 'APPLY', 'HASH(0x8e51fe0)') called at compiled/perl5-kp6-mp6/lib/KindaPerl6/Runtime/Perl5/MOP.pm line 169␤
..main::DISPATCH('HASH(0x824be94)', 'APPLY', 'HASH(0x8e51fe0)') ca...
..pugs: OUTPUT[a␤b␤c␤d␤]
..rakudo: OUTPUT[a␤b␤c␤d␤]
pugs_svnbot r20432 | putter++ | [elf_f] Tweaks. 'use v6;' tolerated. PrimitivesP5.pm created. Pairs tolerated. eval('3') works. Test::is_approx added. 05:37
pmurias allbery_b: re gruntwork, the proxy object is really easy to write in perl5 07:08
Tene perl6: say <a a b b c c d d d d d d d>.uniq
exp_evalbot kp6: OUTPUT[abcd␤]
..pugs: OUTPUT[abcd␤]
..rakudo: OUTPUT[abcd␤]
pmurias in perl5 a perl6 style accesor would be a :lvalue sub which "returns" a tied scalar 07:10
moritz_ a tied? 07:13
pmurias yes
perldoc perltie
moritz_ but the default is a non-tied, right? 07:14
for :lvalue subs, I mean
pmurias yes
pmurias moritz_: i can search for my Proxy implementation if you want 07:17
moritz_ pmurias: don't bother 07:21
pmurias good, i don't know where it is and the nopaste rotted 07:24
moritz_ @tell mncharity re feedback: elf is what I expected, though I find the source code hard to read (for example Match.pm uses Perl 6 syntax and p5 regexes..) 07:48
lambdabot Consider it noted.
moritz_ pugs: say perl(hash(A => 2)) 12:47
exp_evalbot OUTPUT[{("A" => 2),}␤]
moritz_ pugs: say perl(hash('A', 2)) 12:48
exp_evalbot OUTPUT[{("A" => 2),}␤]
moritz_ rakudo: (2, 3).push(4); say 1; 12:52
exp_evalbot OUTPUT[1␤]
moritz_ I'm off for the weekend 13:41
bye
pmurias ruoso: 16:11
ruoso pmurias:
pmurias ;)
what 16:12
ruoso ;)
pmurias 's the best way to do io in smop?
ruoso the biggest problem about it is that there isn't much defined in Perl 6 itself about it...
but in theory...
you can write a low-level object that complies to the IO interface
and it will interoperate freely with the higher-level implementations... 16:13
but there isn't much defined regarding buffering, blocking IO... and all the API for that.. 16:14
rakudo: say IO.^methods()
exp_evalbot OUTPUT[.* method calls not yet implemented. at line 1, near ""␤current instr.: 'parrot;PGE::Util;die' pc 120 (runtime/parrot/library/PGE/Util.pir:82)␤called from Sub 'parrot;Perl6;Grammar;Actions;_block1293' pc 117878 (src/gen_actions.pir:7516)␤called from Sub 'parrot;Perl6;Grammar;Actions;dotty'
..pc 117566 (src/gen_actions.pir:7390)␤called from ...
ruoso rakudo: say IO.^subroutines()
exp_evalbot OUTPUT[.* method calls not yet implemented. at line 1, near ""␤current instr.: 'parrot;PGE::Util;die' pc 120 (runtime/parrot/library/PGE/Util.pir:82)␤called from Sub 'parrot;Perl6;Grammar;Actions;_block1293' pc 117878 (src/gen_actions.pir:7516)␤called from Sub 'parrot;Perl6;Grammar;Actions;dotty'
..pc 117566 (src/gen_actions.pir:7390)␤called from ...
ruoso pugs: say IO.^methods() 16:15
exp_evalbot OUTPUT[*** No such method in class Class: "&methods"␤ at /tmp/oaZgdZ0yTL line 1, column 5 - line 2, column 1␤]
ruoso pugs: say IO.HOW.methods()
exp_evalbot OUTPUT[*** No such method in class Class: "&methods"␤ at /tmp/JugeLmS6ot line 1, column 5 - line 2, column 1␤]
ruoso pugs: say IO.HOW.can('blocking')
exp_evalbot OUTPUT[*** No such method in class Class: "&can"␤ at /tmp/dQze16TWsJ line 1, column 5 - line 2, column 1␤]
ruoso pugs: say IO.can('blocking')
exp_evalbot OUTPUT[*** No such method in class IO: "&can"␤ at /tmp/KLMOMWMVjW line 1, column 5 - line 2, column 1␤] 16:15
ruoso pugs: say IO.^can('blocking')
exp_evalbot OUTPUT[*** No such method in class Class: "&can"␤ at /tmp/f8zHHVPsgu line 1, column 5 - line 2, column 1␤]
ruoso pmurias, it seems no implementation got there yet 16:16
I think it should be Ok to clone IO::Handle interface
ruoso pmurias, which would basically mean that it is ok to have a simple "write" method that "writes" to the file 16:18
ruoso it's nice because write have only positional parameters... which is easy to implement in SMOP 16:18
pmurias there exists docs/Perl6/Spec/IO.pod 16:19
i used a custom object for my hello world needs, but writing an IO class might be a good idea 16:21
ruoso but understand that this class won't be *the* IO class
pmurias why? 16:22
ruoso because *the* IO class must support p6opaque
but you might implement *a* IO class without harm
SMOP is designed in a way that optimized implementations can cohexist freely...
and more importantly, pre-bootstrap implementations can be made to bootstrap the real Perl 6 types 16:24
pmurias the responder could me made an optional parameter to Node right? as it can be taken from the invocant most of the time? 16:29
ruoso nope... the responder is mandatory 16:30
the responder might take it from the invocant.. 16:31
pmurias s/me/be/
ruoso but the dispatch is made *by* the responder
the entire invocation is delegated to the responder
the invocant, otoh is optional... 16:33
although most of the time there's oen
one
but some times, the capture is not really a capture... 16:34
(this is important to avoid infinite loops)
pmurias i don't get the "responder might take it from the invocant.." part 16:35
what's the "it"? 16:36
ruoso my bad...
the invocant might be taken from the capture inside the responder
but that's not always true...
some calls doesn't have invocant...
pmurias what i'm thinking about is that $obj.foo(1,2,3) gets compiled into Node.new(capture=>\(1,2,3),identifier=>"foo",responder=>SMOP_RI($obj)) right? 16:39
the RI is object dependent? 16:40
ruoso not really...
the capture is \($obj: 1,2,3)
pmurias, yes... the RI is object dependent
pmurias sorry, my mistake
ruoso that can be done like that because "foo" is being used statically 16:41
ruoso pmurias, $obj."foo" or $obj.$foo would be a entirely different story 16:41
pmurias $obj."foo" is really $obj.foo 16:42
ruoso well...
pmurias but $obj.$foo is a diffrent story
ruoso $obj."foo" could eventually be optimized to $obj.foo
but by $obj."foo" i really meant $obj."$foo"
pmurias the thing i'm asking is if Node.new dosn't receive a responder argument could it default to SMOP_RI($invocant)? 16:43
as the responder part is a pain when generating Nodes 16:44
ruoso not really... because there are no-op nodes
no-op nodes are nodes without a responder
ruoso are you using sm0p? 16:44
it should make it really simpler
pmurias no 16:45
ruoso why not?
pmurias it's slow
ruoso heh
blame kp6 ;)
pmurias and i'm just going from perl6(elf) Nodes to smop Nodes 16:46
ruoso that's a challenge
pmurias++ if that works it will be *wow* 16:47
pmurias i'm generating c not doing xs so it's not hard 16:49
ruoso: do no-op nodes have a capture? 16:50
ruoso no-op nodes can have anything you want 16:51
except the responder, because then they are op nodes
but most of the time, no-op nodes are used to compose captures...
for instance...
my $a = 1 + 1;
my $b = 2 + 3; 16:52
c($a, $b)
i have to first evaluate the expression "1+1"
then the expression "2+3"
[particle]
.oO(maybe they should be called no-responder nodes)
ruoso then i have to call C with the result of both
SLIME implements that by having a special object you can call
to take results from previous nodes 16:53
and set as a capture of a future node
but if you take "1 + 1"
that is a call on its own...
so you need two no-op nodes
to store those values
and at runtime, compose them into the capture of the "+" call 16:54
so you have
Node::{ result => 1 }, Node::{ result => 1 }, Node::{ capturize the last two into the next }, Node::{ call + (no capture at compose time) } 16:55
it's probably a lame design
but it was the simplest I could fin
find
dealing with register allocation was not something I was willing to do
and variable names are something that will be implemented later 16:56
using this exact same technique
pmurias if we can swap something else in the place of slime later it's ok 16:57
ruoso yeah... that's what the SMOP Interpreter thing is about 16:58
see Polymorphic Eval at the wiki
www.perlfoundation.org/perl6/index....tation_api 16:59
lambdabot Title: SMOP Interpreter Implementation API / Perl 6, tinyurl.com/yv6sur
ruoso that one is better
pmurias i read almost all the stuff on the wiki 16:59
ruoso :) 17:00
pmurias smop related 17:01
pmurias i can use either a helper function for nodes or add a second constructor what's better? 17:02
ruoso in which level? 17:03
at compose time?
ruoso keeps using that term even if that might not make any sense
a helper function to create a node seems ok... 17:04
pmurias in the c code which creates the nodes 17:07
ruoso a helper function is ok 17:08
pmurias ruoso: got something which can do hello world an would like to ci 17:33
ruoso: where should it live?
in elf or in smop?
ruoso :) 17:36
pmurias++
you could put it in smop, because of the build depends
pmurias left it where it was, it can always be moved if mncharity objects ;) 17:41
pugs_svnbot r20433 | pmurias++ | [elf,smop] initial sketch at generating smop Nodes from perl6
ruoso pmurias, where? 17:42
pmurias misc/elf/smop 17:43
ruoso hmm... weird... I don't see it... 17:44
found
does it work? 17:45
pmurias yes 17:46
barely ;)
ruoso :)
pmurias run the generate script 17:47
ruoso ENOTIME 17:48
pmurias has got to do/learn j2me now
pmurias ruoso: how's the grant? 17:59
ruoso no news yet...
but the deadline didn't expire... 18:00
so there should be some time before I get some reply...
I will only be able to start working about the middle of june... so not really in a hurry
pmurias i see 18:01
&
mncharity pmurias: re elf/smop, no problem :) 21:03
lambdabot mncharity: You have 1 new message. '/msg lambdabot @messages' to read it.
mncharity moritz_: re "for example Match.pm uses Perl 6 syntax and p5 regexes..", yeah, early STD_red didn't parse adverbial modifiers, so one couldn't say :p5. that can be fixed now. 21:05
pmurias mncharity: hi 21:08
pugs_svnbot r20434 | putter++ | [elf] Minor tweaks. And a not quite current run-tests.result . 21:12
pmurias would it be hard to have Capture support in elf? 21:13
pmurias i mean just creating captures 21:17
mncharity hi pmurias 21:20
pmurias i'm using Captures to represent Captures in smop Nodes 21:21
and Capture.new(...) is awkard
mncharity the elf side should be ... oh, let's see...
mncharity tries ../elf_f -v -e '(3,4)' , finds out there isn't an ast handler for capture, adding one... 21:22
pmurias \(3:1,2,3) is more tricky 21:25
shower& 21:26
pmurias remember showered already today 21:29
* remebered that hi
pmurias * he 21:30
mncharity pmurias: have some of it. still wrestling with \() (doesn't get recognized as a capture - STD.pm problem?), and \(2:) is misparsing to \(2) ... 21:55
TimToady: (n+1) Are you still collecting STD.pm issues? If so, it's not clear to me that capterm can match '\()'. 21:59
pmurias mncharity: "have some of it" means? 22:01
mncharity currently \(2:) still misparses as \(2), but other than that, literal captures show up as Capture IR nodes (now with a new invocant field). 22:07
at least if their interior is assembled by infix:<,> and <:>. 22:08
mncharity that's the objective, yes? 22:08
you can then emit those IRx1::Capture's as whatever Capture.new(...) you wish. 22:09
pmurias thanks, i'll implement it when the smop Nodes wrappers mature enough to be usefull 22:11
sleep& 22:12
mncharity ok. good night pmurias. /me still puzzling over <statement> managing to accept '2:'... 22:17
meppl good night 22:20
mncharity TimToady: (n+2) Given '2:', it looks like EXPR parses the : as expect_infix, pushes it on the opstack... and then returns, forgetting it's there? /me attempting to parse '\(2:)'. 22:35
mncharity @tell pmurias do you need '\(2:)' (invocant but no other args) to parse RSN? it vaguely looks like STD.pm needs a "more than trivial tweak" to handle it, and I'm trying to not get *too* far ahead of STD.pm. 22:38
lambdabot Consider it noted.
mncharity another hour of life burned in hope of finally having a "usable p6 parser". :/ 22:41
pugs_svnbot r20435 | putter++ | [elf/STD_red] Capture literals begin to parse. \(2:) misparsing as \(2). pmurias++ 23:13
pugs_svnbot r20436 | putter++ | [elf] A temporary file, for exploring performance issues. 23:28
mncharity Drats. Ah well, close enough. 23:29
stevan_/@Moose: misc/elf/elf_f_src/x01.pl is a hand tweaked copy of misc/elf/elf_f from r20434. I removed all the obviously excess "use Moose" and mutability changes. time ./x01.pl is still 3+ sec. Any suggestions on further improving performance? 23:31
mncharity in contrast, the not quite equivalent elf_f_nomoose has a startup of 0.1 sec. 23:33
thanks. help appreciated.
'night all &