Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2008-01-02

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:01 jferrero joined #perl6
00:04 p6quester_ joined #perl6
00:05 theorb joined #perl6
00:14 __Ace__ joined #perl6
00:15 p6quester joined #perl6
00:21 explorer__ joined #perl6
00:21 p6quester__ joined #perl6
00:25 explorer__ joined #perl6
00:26 pugs_svn r19300 | lwall++ | Clarification of substr requested by Gothmog++ and pmurias++
00:26 Limbic_Region TimToady ping
00:27 TimToady pong
00:27 Limbic_Region I have been working my way through the synopses very slowly
00:27 Limbic_Region I have come to a conclusion - perhaps one you already recognized
00:27 Limbic_Region they are too dense for anyone to learn perl 6 from
00:28 TimToady they're not tutorials, fershure
00:28 Tene Limbic_Region: I learned Perl 6 from them.
00:28 Limbic_Region Tene - I assure you, I am talking objectively for the majority and not subjectively for a few
00:29 Tene Well, I already knew Perl 5.
00:29 Tene Limbic_Region: Okay.
00:29 Limbic_Region TimToady - so, is there a specific project to make the documentation more accessible or is the idea to wait for Learning Perl 6?
00:30 TimToady It's certainly something that needs doing one way or another.
00:30 TimToady The synopses aren't even in any kind of rational order internally; the only one that has actually ever been reorganized is S03
00:32 Limbic_Region well, I have some ideas but it really requires a collaborative effort
00:34 Limbic_Region TimToady - in a nutshell, I think almost every new non-perl 5 concept requires a mini-tutorial
00:34 p6quester joined #perl6
00:34 Limbic_Region traits, roles, mixins, the advanced type system, etc
00:37 TimToady (sorry, watching Rose Bowl...)
00:38 Limbic_Region no worries - I am not into college football, but being from Maine - I was very much interested in the Patriots this past Saturday
00:41 Limbic_Region TimToady - in any event, as I work through these synopses I want to write code to assimilate it.  I am having a hard time doing this because the code snippets are far too concise.
00:41 Limbic_Region TimToady - once the code is written, I think it would be a nice contribution to a tutorialish type doc project
00:42 Limbic_Region TimToady - but I am going to need a really in the know resource to help me as I stumble through
00:42 * Limbic_Region AFK but will be back in a bit
00:42 r0bby joined #perl6
00:45 wolverian Limbic_Region, Learning Perl 6?
01:00 p6quester joined #perl6
01:02 seablue100 joined #perl6
01:03 _sprocket_ joined #perl6
01:07 seagreen100 joined #perl6
01:08 meppuru good night
01:16 [particle1 pugs: :8<0.0>
01:16 exp_evalbot RESULT[0/1]
01:16 cnhackTNT joined #perl6
01:17 [particle] pugs: say :8<0.1**2>
01:17 exp_evalbot OUTPUT[0.15625␤]
01:22 [particle] pugs: say :8<0.1*2**2>
01:22 exp_evalbot OUTPUT[0.16015625␤]
01:24 TimToady doesn't look right to me
01:24 [particle] me neither
01:24 [particle] not terribly surprising, given the lack of tests
01:24 TimToady and the first form is illegal syntax
01:24 [particle] however, i think STD is wrong, too
01:25 [particle] yes, that's what i see in STD, the first form is illegal
01:25 thoughtpolice joined #perl6
01:25 [particle] $<radfrac> = [ '.' <[ 0..9 a..z A..Z ]>+ ]? ] # one too many ']' ??
01:25 [particle] (in token rad_number)
01:27 pugs_svn r19301 | lwall++ | Extra right bracket noticed by [particle]]++
01:27 [particle] ha! also, having an alias called 'radint' as well as a rule called 'radint' is potentially confusing
01:28 TimToady prolly
01:33 han_ joined #perl6
01:34 pugs_svn r19302 | lwall++ | [STD] "radint" ambiguity pointed out by [particle]++
01:38 [particle] is $<fracpart> an array, and is '.' captured?
01:38 justatheory joined #perl6
01:48 alester joined #perl6
01:50 TimToady no, [...] just captures a string
01:51 seablue100 joined #perl6
01:51 pugs_svn r19303 | lwall++ | Another spurious bracket
01:51 [particle] hrmm, i'll need to come up with a perl6 replacement  for radint, since we don't have <?{...}> yet
01:52 [particle] i'll hardcode the bits of rad_number that matter
01:59 [particle] TimToady: how's this look? http://rafb.net/p/eOSFla31.html
02:07 TimToady seems pretty okay
02:08 pugs_svn r19304 | lwall++ | Previous radint change was incomplete.
02:12 TimToady in fact, I might end up refactoring STD that way
02:13 jjore-m joined #perl6
02:31 [particle] it's likely a *very* minor optimization
02:32 Limbic_Region TimToady - was the outcome of the Rose Bowl what you wanted?
02:34 [particle] damned you, georgia!
02:34 jisom joined #perl6
02:34 [particle] l_r: my team came awful close to kicking your team's butt
02:35 [particle] ...saturday.
02:36 Limbic_Region [particle] - um, came close to winning perhaps - butt kicking, I think not
02:37 [particle] TimToady: my refactor of radint allows my grammar action for radint to be *very* simple: method radint($/, $key) { make $( $/{$key} ); }
02:48 [particle] TimToady: :8<0b1110> doesn't seem to be a valid rad_number... you need [...] or (...) in order to parse it. is that intended?
02:49 TimToady yes
02:49 [particle] ok, then t/syntax/numbers/octal.t is wrong
02:50 [particle] ...and likely some other t/syntax/numbers tests
02:50 [particle] */ tests
02:51 [particle] ack. window transparency fooled me into thinking i had mistated myself
02:51 TimToady actually, :8<0b1110> should parse but fail in radcalc with an invalid digit, I think
02:52 TimToady I can see the argument for allowing it though
02:52 [particle] in perl6 it fails to parse, with Statement not terminated properly at line 43, near "(:8<0b1110"
02:52 [particle] that's the expected error for a failed statement
02:52 TimToady nevertheless, :16<0b1110> is certainly a hex number
02:53 [particle] in any case, the tests are wrong, because the smart link points to # L<S02/Literals/"Think of these as setting the default radix">
02:53 TimToady well, you can't have separate rules for every radix
02:53 [particle] but it's talking about :8($x) not :8<$x>
02:54 TimToady yes, the question is whether the same calculation is done by radcalc, and how does it know that the 8 in that case is just a default radix?
02:56 TimToady if radcalc is used for both purposes, all it can do is guess based on the suggested radix, since 0b is illegal octal and decimal, but valid hex
02:56 TimToady alternately, radcalc needs a flag to tell it whether to guess based on the string prefix
02:57 [particle] radcalc has enough args to justify named args imo
02:57 TimToady in which case the default should be to not guess, I guess
02:57 [particle] agreed
02:58 TimToady but I'd really like to allow people to say 0xdeadbeef where a decimal is expected on input
02:58 TimToady it's just the literal forms that don't make sense with :10<0xdeadbeef>
02:58 TimToady that's just perverse
02:58 [particle] please! you've got to keep *some* of perl's perversity!
02:59 TimToady I think that'll happen by accident in any case. :)
02:59 [particle] ha! no doubt.
03:00 [particle] perl6 doesn't seem to parse :8(0b1), which i find odd
03:02 [particle] since integer is a number is a value is a noun is a term
03:04 [particle] i suppose :8(<0xdeadbeef>) is workable
03:07 [particle] token integer in STD doesn't mesh with S02. i don't see where \0 is defined
03:08 [particle] from S02:2046
03:17 _sprocket_ joined #perl6
03:19 jjore-m left #perl6
03:20 pugs_svn r19305 | lwall++ | [STD] qq_backslash for \0 missing, [particle]++
03:23 lampus_ joined #perl6
03:29 _sprocket__ joined #perl6
03:40 _sprocket_ joined #perl6
03:43 _sprocket___ joined #perl6
03:49 awwaiid joined #perl6
03:51 kanru joined #perl6
04:01 lampus joined #perl6
04:25 lampus_ joined #perl6
04:37 wolverian is adriano ferreira here?
04:38 wolverian we were talking about http://www.oreillynet.com/onlamp/blog/2007​/12/yap6_operator_reduce_operators_1.html on an unnamed #perl, and were wondering if <!after '/'> makes sense in the context, and if the = in =[\~] is really needed
04:44 TimToady the = is unnecessary there
04:44 TimToady [\X] always produces a list
04:48 wolverian that's what I thought
04:48 wolverian how about the <!after '/'>? seems it should be just <after />?
04:49 Tene pugs: split /<!after '/'>/, 'foo/bar/baz'
04:49 exp_evalbot OUTPUT[*** ␤    Unexpected "'>/,"␤    expecting term postfix, operator, ":" or ","␤    at /tmp/i30GNfTlBQ line 1, column 18␤]
04:49 Tene pugs: split /<!after '\/'>/, 'foo/bar/baz'
04:49 exp_evalbot OUTPUT[*** Cannot parse regex: <!after '\/'>␤*** Error: Error: Undefined subroutine &Pugs::Emitter::Rule::Perl5::after called at /home/evalenv/pugs/perl5/Pugs-Compile​r-Rule/lib/Pugs/Emitter/Rule/Perl5.pm line 124.␤␤]
04:51 TimToady well, these days <?after /> would be more like it
04:52 wolverian ah, okay.
04:52 wolverian there's one <after in S05
04:56 TimToady <after is okay, but captures to $<after> by default
05:01 lorn joined #perl6
05:10 wolverian righto, should have read. thanks again :)
05:10 wolverian now, sleep
05:12 Daveman joined #perl6
05:13 Limbic_Region TimToady - does your local church make audio of weekly sermons available online?
05:17 Limbic_Region nevermind - I followed the link from your website and apparently the answer is yes
05:19 TimToady reminds me, I have a .wav I need to turn into a .mp3 at some point for 12/16
05:28 nothingmuch joined #perl6
05:37 p6quester joined #perl6
05:40 thoughtp1lice joined #perl6
05:59 seablue100 in STD.pm, what is unsp and unv?
06:30 alc joined #perl6
06:52 dduncan joined #perl6
06:53 cnhackTNT joined #perl6
07:07 dduncan left #perl6
07:16 alester joined #perl6
07:22 iblechbot joined #perl6
07:29 pugs_svn r19306 | pmichaud++ | Some initial test refactors and cleanups for basic operators.
07:32 pugs_svn r19307 | pmichaud++ | add some comments to existing tests about refactoring targets.
07:41 drrho joined #perl6
07:46 Aankhen`` joined #perl6
07:54 lyokato_ joined #perl6
08:04 han_ joined #perl6
08:04 BinGOs joined #perl6
08:15 BinGOs joined #perl6
08:22 chacha_chaudhry joined #perl6
08:22 idiotmax joined #perl6
08:36 meppuru joined #perl6
08:44 IllvilJa joined #perl6
09:08 H0LE joined #perl6
09:19 devogon joined #perl6
09:21 ruoso joined #perl6
09:36 penk joined #perl6
09:53 elmex joined #perl6
10:12 jferrero joined #perl6
10:27 theorbtwo joined #perl6
11:22 chris2 joined #perl6
11:39 polettix joined #perl6
12:12 fglock_ joined #perl6
12:48 iblechbot joined #perl6
13:00 pmurias joined #perl6
13:01 pmurias fglock: hi
13:01 fglock pmurias: hi
13:01 pmurias fglock: have you seen the Perl5V6 backend?
13:02 fglock not yet - I saw the commits
13:04 pmurias the thing i'm not sure how should be done is the calling convention
13:06 pmurias should i remove Perl5Cached and TokenC?
13:08 cmarcelo joined #perl6
13:14 fglock you mean, you need to know how the v6.pm calling convention works?
13:16 pmurias fglock: i'm not sure if using the v6.pm calling convention is the right thing
13:17 pmurias i haven't looked into Data::Bind internals but read the (scant) docs and looked at he test suit,so it's no a problem
13:18 pmurias i wrote a primitive benchmark misc/calling_convention_benchmark.pl, and i'm not sure if it won't be a big performance hit
13:19 fglock yes, you could keep most of the current kp6-perl5, and replace the object system and binding only
13:20 fglock I'm not sure what problems you will find ahead
13:20 fglock but it's worth trying
13:21 pmurias fglock: does anything problematic come to your mind?
13:21 pmurias (besides concurency)
13:21 pmurias what parts do you think we could keep?
13:22 fglock hmm - there is the BEGIN problem, which we fixed by using the "modified" flag
13:23 pugs_svn r19308 | pmurias++ | [kp6] removed KindaPerl6::Visitor::Emit::Perl5Cached
13:23 fglock re keep, kp6-perl5 parameter passing is better than v6.pm
13:23 pmurias fglock: the way i plan to keep it for now is to use the orginal Perl5 backend for begin blocks
13:23 fglock yes, but it will break when it bootstraps
13:24 fglock the Parrot backend has the same problem
13:25 fglock weird, the Parrot backend has more problems than the Perl5 backend
13:25 pmurias fglock: we can keep it for a bit after the bootstrap, and switch to saving the env later
13:27 pmurias the Perl5V6 was going pretty smooth
13:27 pmurias s/was/is
13:27 fglock :)
13:28 fglock you could emit the "modified" flags - the first versions of kp6 used to work like that
13:29 fglock or you could just ignore it for now, just leave some comments in the code
13:30 pmccann_ joined #perl6
13:30 pmurias fglock: i would strongly prefare the later
13:30 fglock ok
13:30 fglock that's how "perl6" works
13:33 fglock hmm - I wonder if the Coro module could give us enough introspection to make a dump of the compile-time environment
13:38 fglock doesn't seem so
13:39 pmurias fglock: it think the contrary
13:39 pmurias Coro::State::call
13:41 lichtkind joined #perl6
13:42 pmurias Pad::eval_ast seems to use Emit::Perl5V6 is it possible?
13:42 fglock $state->eval looks useful - I liked the comments too
13:42 lichtkind is it true that array munging operators were especially inspired my haskell or similiar languages?
13:43 fglock pmurias: $visitor_emit_perl5 is hardcoded in Pad.pm
13:43 pmurias yes
13:44 pmurias try script/kp6 -Bperl5v6 t/kp6/06-begin.t
13:45 fglock one sec
13:47 fglock pmurias: do you get this error? Can't use string ("2") as a HASH ref while "strict refs" ... Perl5/Pad.pm line 422
13:47 pmurias yes
13:52 chruck left #perl6
13:55 pmurias fglock: why do we need to use Coro, isn't PadWalker enough?
13:56 fglock PadWalker needs to be executed from inside the closure, I thought Coro could give some other options
13:59 pmurias ah
13:59 pmurias $stuff but other&
14:06 fglock pmurias: re emit_perl5 x emit_perl5v6, "class Lit::Code" is redefining several methods
14:08 alester joined #perl6
14:12 pmurias fglock: thanks, fixing
14:12 fglock pmurias: I'm fixing here
14:13 fglock didn't work - please go on :P
14:14 fglock ok, got it
14:14 pugs_svn r19309 | fglock++ | [kp6-v6] fixed method name collision
14:16 jhorwitz joined #perl6
14:18 pmurias 3 tests more pass :)
14:33 overlast1 joined #perl6
14:35 chris2_ joined #perl6
14:43 avar why make it run on v6 isn't that pre-mp6?
14:45 pmurias avar: the name is misleading
14:45 pmurias Perl5V6 emits perl5
14:45 han_ joined #perl6
14:46 pmurias but does it in a style similiar to v6, maping directly to perl5 instead of creating a layer between
14:47 pmurias avar: if you can think up a better name, suggest it ;)
14:47 avar I thought it was using v6.pm
14:48 fglock avar: it is using v6.pm "runtime"
14:49 pmurias Data::Bind that is
14:49 fglock that is, Moose and Data::Bind
14:49 pmurias by the way help on it is welcome ;)
14:50 avar can you paste some generated code for this and the normal perl5 backend? It would be interesting to see what p5-directly looks like
14:50 pmurias s/on/with/
14:50 pmurias avar: use can use script/kp6 -Cperl5v6
14:52 pmurias avar: or do you want be to nopaste some code?
14:53 pasteling Someone at 81.168.228.98 pasted "../../t/01-sanity/01-tap.t #kp6 -Cperl5v6" (32 lines, 890B) at http://sial.org/pbot/29541
14:55 pasteling Someone at 81.168.228.98 pasted "../../t/01-sanity/01-tap.t #kp6 -Cperl5" (50 lines, 3.1K) at http://sial.org/pbot/29542
14:55 pmurias pasted 01-sanity/01-tap.t
14:57 avar interesting
15:12 _sprocket_ joined #perl6
15:19 ruoso fglock, did you get to any conclusion on my capture's question?
15:26 fglock ruoso: no
15:26 ebassi joined #perl6
15:28 fglock brb
15:29 mncharity joined #perl6
15:38 |Jedai| joined #perl6
15:42 fglock mncharity: hi
15:43 ruoso TimToady, could you please ellaborate more on captures in the specs? I'm having a hard time getting how they should behave...
15:46 pjcj joined #perl6
15:51 thoughtpolice joined #perl6
15:56 TJCRI joined #perl6
16:17 alester joined #perl6
16:23 rindolf joined #perl6
16:29 PerlJam ruoso: captures are an unruly bunch. They don't behave.
16:29 Psyche^ joined #perl6
16:29 TimToady I seem to have missed the question
16:30 TimToady and do you mean captures or Captures?
16:31 mncharity hi fglock! :)
16:37 barney joined #perl6
16:47 ruoso TimToady, Captures
16:47 ruoso TimToady, as in $a = \(1,2,3); or in $a := %a<b><c>
16:49 TimToady what would you like elaborated?
16:51 ruoso how does \%a<b><c> affects %a<b><c>
16:51 ruoso is one of the things
16:51 ruoso should capture creation be understood as a "context", as would be scalar?
16:52 PerlJam ruoso: taking the Capture doesn't do anything to the underlying data structure AFAIK if that's what you're asking.
16:52 ruoso PerlJam, you see, that's the point where I get confused...
16:52 ruoso how then \%a<b><c> autovivifies the hash, while just %a<b><c> doesn't
16:53 TimToady it should not autovivify unless bound to something rw
16:53 ruoso hmmm...
16:53 * ruoso looking again
16:54 TimToady just as foo(%a<b><c>) doesn't autovivify unless its first parameter is rw
16:54 ruoso my $a = \%a<b><c> autovivifies
16:54 TimToady a Capture is just a snapshot of an unbound argument list
16:55 TimToady "my $a" defines a rw variable
16:55 TimToady so yes
16:55 ruoso ok... how should a Capture object look like/
16:55 ruoso ?
16:55 ruoso thinking about data structures
16:55 TimToady that's an implementation detail  :P
16:55 ruoso ok... I need some help with that...
16:55 ruoso :)
16:56 PerlJam ruoso: I think TimToady is only good for suppositional implementations these days  :)
16:56 ruoso I still can't figure out how the capture binding can trigger the autovivification
16:56 ruoso be it to a variable or to a signature
16:57 ruoso PerlJam, a supositional would be enough for me now...
16:57 ruoso :)
16:58 PerlJam ruoso: okay, suppose you have a spherical cow of uniform density ...
16:58 TimToady and suppose that cow can contain a Failure that knows how to autovivify something in order to "unfail"
16:58 rindolf joined #perl6
16:58 ruoso ok
16:59 TimToady and suppose an rw binding looks at the cow, and calls the autovivify method on it
16:59 TimToady only without the cow
16:59 ruoso ok, so the binding process should explicitly call the autovivification?
17:00 ruoso hmmm
17:00 ruoso I was counting on that being part of the logic of the array and hash types
17:00 TimToady if it needs an rw binding
17:00 rindolf Hi all.
17:00 rindolf Hi TimToady , ruoso
17:00 ruoso hi rindolf
17:00 rindolf Happy new year.
17:00 TimToady hi rindolf, happy solar new year
17:00 TimToady or at least, civic...
17:01 ruoso so, a Capture is just a container object that doesn't enforce any context, is it?
17:01 TimToady basically. context is enforced lazily by binding
17:01 rindolf TimToady: thanks.
17:01 rindolf TimToady: what's up?
17:01 TimToady that's how we get out of most of the nasty Perl 5 traps
17:02 TimToady and why signatures work much better than prototypes
17:02 TimToady and can work on methods as well as functions
17:02 PerlJam TimToady: more evidence of Laziness as a virtue.
17:02 ruoso ok... If i let the autovivification to be a feature of the interpreter in itself, instead of a feature of the array type
17:02 ruoso or the hash type
17:03 ruoso I mean
17:03 ruoso instead of the array and hash autovivify by themselves,
17:03 ruoso the binding code would do it
17:04 TimToady well, the binding code just knows how to tell the "nonexistence" Failure object to undo itself
17:04 TimToady and that object knows how to tell the hash or array to create the required value
17:04 TimToady but the hash or array still has to participate
17:05 ruoso Ok...
17:05 ruoso that clarifies a lot
17:06 TimToady most of the time, in rvalue context, a Failure just looks like "undef" to a Perl 5 programmer, but that's just because in real rvalue context it's never going to be bound to something rw
17:06 TimToady and, of course, if the compiler can detect that, it can maybe optimize away some of the autoviv apparatus, if it's heavy
17:07 TimToady but maybe it isn't.
17:07 ruoso but... wasn't Failure supposed to raise an exception?
17:07 ruoso or is this just yet another undef type and not exactly a failure
17:08 TimToady Failure throws an exception only if 1) you've said "use fatal" or 2) you try to use the actual value from it.
17:08 TimToady it's possible that most Failure objects are actually typed correctly for the return value expected, so they're really protoobjects that know they're also Failures
17:09 ruoso hmmm... I understood that the "use fatal" would make them to raise the exception in-time instead of lazy
17:09 TimToady so if you have a hash that you know returns Dog, you really get an undefined Dog out of it, and that Dog knows how to autoviv itself to a real dog object
17:10 TimToady er, that's what I just said under 1)
17:10 TimToady use fatal makes it throw and exception immediately
17:10 ruoso ah... ok...
17:10 ruoso So, if you just ignore the return is the same as catching the failure
17:10 TimToady so, I guess you don't get any autoviv under "use fatal" either...
17:11 ruoso that's odd
17:11 TimToady maybe the return protoobjects aren't considered failures then, unless you "use fataler"
17:12 * ruoso remembers reading that the failure would raise when getting out of the scope... isn't ignoring return a way of getting the value out of scope?
17:13 TimToady hmm, yeah, I recall something like that too...
17:14 ruoso anyway...
17:14 ruoso wouldn't Unintialized a better definition of the non-existant?
17:14 TimToady that's what a protoobject means
17:14 ruoso so, uninitialized is not a failure, is it?
17:15 TimToady correct
17:15 ruoso ok..
17:15 TimToady so if autovivifyers return protoobjects instead of failures, that would allow autoviv under fatal
17:15 ruoso so the autovivification triggering belongs to the Uninitialized object
17:15 TimToady which seems right
17:15 TimToady lemme think about it in the shower
17:15 fglock (that's "ValueProxy" in kp6)
17:16 TimToady we may have just generalized that to Dog :)
17:16 ruoso so, the thing that triggers it is the binding process, right?
17:16 ruoso the binding would call Autovivify in the Uninitialized object...
17:17 TimToady yes, something like that
17:17 ruoso no matter if binding to a variable or to a signature
17:17 ruoso one other thing..
17:17 TimToady a variable is just a degenerate signature
17:18 * [particle] hums "officer krupkie"
17:18 ruoso my $a := %a<b><c>; my $b := %a<b><c>; $a = 1;
17:18 ruoso this is an interesting case,
17:18 TimToady $a and $b should be the same container
17:19 ruoso so, a capture for %a<b><c> is not for the value of %a<b><c>,
17:19 ruoso but for %a<b><c> in itself
17:19 TimToady correct, captures have to be able to do container aliasing
17:19 ruoso but, if %a<b><c> wasn't autovivified yet
17:20 ruoso what does $a points to
17:20 TimToady an abstraction
17:20 TimToady that's what the "a" is for, after all  :)
17:21 ruoso so, the unintialized object captured in %a<b><c> would have to keep a reference to "%a<b> looking up for <c>"
17:21 ruoso which, in fact would be
17:21 ruoso (looking for <c> in (looking for <b> in %a))
17:21 TimToady when you autovivify, you have to create any missing elements, and also make sure to reuse and elements that were already created by someone else
17:21 TimToady (in the meanwhile)
17:22 TimToady yes
17:22 TimToady when nested arrays are referenced, they pass protoobjects down that get wrapped up by the lower down array in another protoobject, I think
17:23 * ruoso feels like programming functional, and for the first time, really understands it
17:23 TimToady cool
17:24 TimToady shower &
17:26 fglock ruoso: kp6 implements it that way
17:26 ruoso fglock, ok... I need to adjust how yap6 does it
17:26 fglock except that binding autovivifies, I think
17:27 fglock re binding, I think I read it somewhere in the spec
17:27 ruoso the difference is that I was returning a scalar from the list and the hash
17:27 ruoso and I should be returning captures
17:27 ruoso or not
17:28 ruoso should a lookup in an array return 1) a scalar 2) a value or 3) a capture?
17:28 penk joined #perl6
17:28 fglock I think Parrot doesn't do hash/array laziness either
17:29 ruoso scalar is probably out of the case, because that would pre-enforce scalar context
17:29 ruoso which is not the case
17:29 Psyche^ joined #perl6
17:29 ruoso I think it's between value or capture
17:29 ruoso as there's \%a<b><c>, it probably should return a value
17:31 fglock ruoso: it depends on the hash current content
17:31 ruoso for the uninitialized, i mean
17:32 ruoso actually, for the API, i mean
17:32 fglock kp6 returns a special case of scalar
17:32 ruoso yeah... but then you're forcing scalar context
17:32 ruoso which may not be the case
17:32 fglock it's called "ContainerProxy"
17:32 fglock it's not a scalar
17:33 fglock it can be Hash, Array, or Scalar
17:33 ruoso ContainerProxy is what the Capture would be, isn't it?
17:33 fglock it depends on how you use it later
17:33 ruoso so it's the capture
17:33 fglock no
17:34 ruoso fglock, no?
17:34 fglock Capture is a collection
17:34 fglock ContainerProxy is a single thing
17:35 ruoso \%a<b><c> is a capture
17:35 fglock but you can make a Capture with a single ContainerProxy
17:35 fglock yes
17:35 ruoso which is the same as \(%a<b><c>)
17:35 ruoso which makes sense with what you're saying
17:39 fglock kp6: my %a; my $b = \(%a{1}); say $b.perl
17:39 exp_evalbot r19309: OUTPUT[\( undef,  )␤]
17:40 fglock that doesn't help - .perl simplifies the output
17:40 ruoso kp6: my %b; my $a = %b<c><d>; say $a.perl;
17:40 exp_evalbot r19309: OUTPUT[syntax error at position 22, line 1 column 22:␤my %b; my $a = %b<c><d>; say $a.perl␤                      ^ HERE␤]
17:40 ruoso kp6: my %b; my $a := %b<c><d>; say $a.perl;
17:40 exp_evalbot r19309: OUTPUT[syntax error at position 23, line 1 column 23:␤my %b; my $a := %b<c><d>; say $a.perl␤                       ^ HERE␤]
17:41 ruoso kp6: my %b; my $a := %b{'c'}{'d'}; say $a.perl;
17:41 exp_evalbot r19309: OUTPUT[undef␤]
17:41 ruoso kp6: my %b; my $a := %b{'c'}{'d'}; say %b.perl;
17:41 exp_evalbot r19309: OUTPUT[{  }␤]
17:41 ruoso kp6: my %b; my $a := %b{'c'}{'d'}; say %b.elems;
17:41 exp_evalbot r19309: OUTPUT[0␤]
17:41 ruoso ops
17:41 ruoso kp6: my %b; my $a = \(%b{'c'}{'d'}); say %b.elems;
17:41 exp_evalbot r19309: OUTPUT[syntax error at position 13, line 1 column 13:␤my %b; my $a = \(%b{'c'}{'d'}); say %b.elems␤             ^ HERE␤]
17:42 dlocaus joined #perl6
17:42 dlocaus yikes, reading 2 weeks of perl6 logs...
17:42 dlocaus Hello!
17:45 fglock dlocaus: welcome back
17:45 dlocaus thank you, I had a nice X'mas.
17:45 dlocaus Did you have a nice New year?
17:46 fglock yes, thanks :)
17:46 dlocaus fglock: I'm catching up (reading IRC logs on perlgeek.de) is there anything you need done? Before you head on home?
17:48 fglock dlocaus: there is lots to do, but I could not update the project plan yet
17:48 dlocaus ok.
17:49 dlocaus I'll check around then, when I am done reading the IRC logs.
17:49 fglock we are currently working on supporting Parrot, Perl5+Moose+Data::Bind, and C
17:49 fglock we are blocked in several places
17:50 dlocaus ok
17:50 fglock which is the reason you deon't see many commits lately
17:50 fglock don't
17:50 dlocaus Data::Bind as the one by Chia-liang Kao?
17:50 fglock yes
17:51 pmurias dlocaus: hi
17:51 dlocaus pmurias: hello!
17:52 pmurias Perl5+Moose+Data::Bind is mostly blocked by my lack of time
17:53 dlocaus I wonder if the the Perl6::* packages will have perl6 done before anyone else?
17:53 fglock dlocaus: see v6.pm
17:57 pmurias the Perl5+Moose+Data::Bind is avalible with -{C,B}perl5v6
17:57 TJCRI joined #perl6
18:01 dlocaus http://en.wikipedia.org/wiki/Transactional_memory : Interesting (I found it when looking at an IRC link)
18:02 dlocaus /found/looked it up/
18:13 meppuru joined #perl6
18:15 Daveman joined #perl6
18:16 bwisti joined #perl6
18:17 ruoso so.... a capture object has the members: invocant, positional and named
18:18 ruoso it doesn't enforce any context
18:20 meppuru joined #perl6
18:21 fglock actually, kp6 captures now only have positional members - "named" is a special case of positional
18:21 fglock but that's an implementation detail, probably
18:21 ruoso fglock, not sure...
18:21 ruoso i was reviewing s06
18:22 ruoso and it seems that the capture composition defines if it's named or positional
18:23 _sprocket_ joined #perl6
18:23 fglock yes, but you need to keep the ordering, for matching captures to signatures
18:24 ruoso I think (1,2,3,:a<b>,4) have 1,2,3,4 as positional and a<b> as named
18:24 ruoso I don't think a<b> counts as positional
18:24 fglock that's right,
18:24 fglock but you need to record the position of "a"
18:25 fglock you may need it later
18:25 pmurias fglock: when?
18:25 fglock it depends on the signature that the capture will match to
18:26 fglock see the algorithm at Emit::Perl5, it needs to scan the capture in order
18:26 TimToady order matters if you have two :a
18:27 ruoso you shouldn't be able to fetch named as positional, if that's what you mean, fglock
18:27 ruoso TimToady, but that's at capture composition, isn't it?
18:27 fglock ruoso: no, I mean matching captures to signatures
18:27 TimToady question is, if you bind to |$capture, can you reconstruct the original call order and do something else
18:28 fglock this was implemented after a discussion here, about 2 months ago I think
18:28 ruoso fglock, why would you need the order for named there? (except for several of the same name?)
18:28 TimToady I tend to agree with the opinion of not forgetting anything that might be useful later
18:29 TimToady even if that later use is unconventional
18:29 fglock ruoso: I don't remember - looking
18:29 Jamtech joined #perl6
18:30 TimToady also, if the only thing you bind is a perl 5 style *@_, arguably that should contain the named args
18:31 ruoso TimToady, at some place in the synopsis, it says that the capture coerced to array should return the positional args
18:31 TimToady well, likely, but there needs to be some way to get at the original arguments in pristine form
18:32 ruoso *@_, *%_
18:32 TimToady that throws away position info on *%_
18:32 TimToady what if you're writing a macro that does something different to its args?
18:33 TimToady maybe it's just "bind to |$capture and then call $capture.originalargs" or some such
18:33 ruoso TimToady, that's much more sane
18:34 TimToady or possibly it's the default binding of @_ when there's no sig
18:34 ruoso if you wish to use the args as a capture
18:34 ruoso you can just declare your signature accordingly
18:34 TimToady but maybe it's more useful if the no-sig case automatically sets *%_ as well
18:34 ruoso I would expect so
18:35 ruoso whereas @_ has only the positional and %_ only the named
18:35 TimToady however, that makes it a little harder to translate p5 to p6
18:36 ruoso list to hash coercion in Perl 6 won't do what p5 does already
18:36 TimToady it's pretty close
18:36 TimToady a => 'b' still does the same thing
18:36 TimToady just via Pair object
18:36 TimToady (assuming the original P5 code didn't get out of sync)
18:36 TimToady I suppose the p5-to-p6 translation must really turn => into ,
18:37 ruoso a => b does, but 'a', 'b' doesnt
18:37 TimToady yes, which is why it has to remove => and replace with ,
18:37 TimToady because p5 intermixes them freely
18:37 TimToady and you can't undo the %args = @_ idioms in the sub
18:38 TimToady maybe we need a p5-ish => equivalent
18:38 ruoso I, personally, wouldn't care too much with p5->p6 translations
18:38 ruoso the language is already too different
18:38 TimToady it's just one factor to bear in mind, but we don't want to make people miserable unnecessarily
18:39 TimToady we're already going to have various p5ish variants of some of the builtin functions
18:39 ruoso in Perl 6, when you have a list coercion to hash, you pair two by two?
18:39 TimToady so maybe a p5=> isn't so farfetched
18:40 TimToady unless the next arg is a Pair or a Hash
18:40 ruoso ok
18:41 TimToady so %foo = a => 1, 'b', 2; does the Right Thing
18:41 ruoso but anyway...
18:41 ruoso having @_ to return the named arguments seems a little bad
18:41 TimToady I think I like the p5=> solution.  it means comma, but is really ugly and easy to search for when you want to convert to real =>
18:42 TimToady p5=> would suppress that
18:42 TimToady since it's just a comma
18:42 TimToady it would come in as @_
18:42 ruoso hmmm
18:42 ruoso I see
18:42 TimToady when you switch to real => it comes in as %_
18:42 TimToady but you have to change the sub at the same time
18:42 ruoso sure
18:43 TimToady and we've already got p5foo emulator functions elsewhere, so it's not like a new meme
18:44 ruoso ok... so the default sig is to get all positional to @_ and all named to %_
18:44 fglock ok, I reviewed the kp6 code - Capture does have separate named/positionals,
18:44 fglock (the Capture is created from a plain list of named+positionals)
18:50 ruoso thinking in the low level
18:53 ruoso \%a<b><c> is really something like: "capture capture( %a: 'b' ): 'c' ", while plain %a<b><c> is something like "fetch capture(%a: 'b'): 'c' "
18:56 ruoso or even deeper... fetch(capture(capture(MY: 'a'): 'b'): 'c')
18:57 ruoso actually... fetch(capture(capture(MY: '%a'): 'b'): 'c'), as the sigil is part of the name
18:59 ruoso so... capture is a "method" of hash
18:59 ruoso that, just as fetch, receives the key name
18:59 ruoso actually the key object
19:00 ruoso and the hash as the invocant
19:00 ruoso but I'm still missing the context...
19:00 ruoso maybe...
19:01 fglock ruoso: captures and lookups are different things
19:02 ruoso fetch(hash(capture(hash(capture(MY: '%a'):):): 'b'):): 'c')
19:03 ruoso fglock, but both are methods of the containers
19:04 ruoso and the values also, actually
19:04 ruoso you can do \3
19:07 fglock kp6: say \(3).perl
19:07 exp_evalbot r19309: OUTPUT[\( 3,  )␤]
19:08 fglock but this is Capture.new( positionals => [ 3 ] )
19:09 ruoso what is just what I would mean in the pseudocode I written above as a call to capture without invocant
19:10 ruoso the thing is that a capture of %a<b><c> must relate to %a<b>: 'c'  and not to %a<b><c> directly
19:10 ruoso because
19:11 ruoso my %a; my $b := %a<b><c>; my $c := %a<b><c>; $c = 1;
19:12 fglock I've got to leave  &   # will backlog
19:13 ruoso $c and $b are bound to the lookup of c in the lookup of b in %a
19:14 ruoso hmmm
19:14 ruoso but that's why capture autovivifies
19:14 ruoso but...
19:14 ruoso what happens when
19:14 ruoso my %a; my $b := %a<b><c>; %a<b> = { c => 1 };
19:15 ruoso TimToady, what should happen in the above code? should $b equals 1?
19:16 dlocaus moritz: http://irclog.perlgeek.de/perl6/2007-12-28 (next day doesn't link to 2007-12-29... (next day link is missing) fyi.
19:16 ruoso if not? what should $b point to?
19:16 PerlJam ruoso: $b should be 1 but that has nothing to do with Captures.
19:17 ruoso PerlJam, how so?
19:17 ruoso dlocaus, that was when the logger was out
19:18 dlocaus humm
19:22 PerlJam ruoso: caveat lector as I'm just a humble reader of synopses, but I don't think captures have replaced references quite like you think.  %a<b><c> will lazily auto-vivify a hash (or two) as needed.  There are no Captures there.
19:23 ruoso PerlJam, as I understood so far, binding is really Signature := Capture
19:24 PerlJam perhaps.  I haven't read this stuff in a while so I'm just working from memory.
19:24 ruoso TimToady just said... "a variable is just a degenerate signature"
19:24 Limbic_Region joined #perl6
19:24 PerlJam What you're saying doesn't jibe with my memory. So one or the other is off :)
19:24 PerlJam (or both)
19:25 ruoso PerlJam, S02 # immutable types
19:25 ruoso Capture (right side of a binding)
19:26 ruoso Signature (left side of a binding)
19:26 * ruoso going home
19:26 * ruoso probably gets online later today
19:26 * ruoso will backlog
19:27 PerlJam ruoso: sure, but since you have a $scalar on the left side, I think what happens is that the Capture is optimized away into just its scalar component
19:27 ruoso hmmm... isn't that what the assignement would do?
19:28 ruoso I think the regular use of the variable will imply scalar context
19:29 ruoso but the container is still whatever it is
19:29 ruoso it may be a hash
19:29 PerlJam It's best to let people of TimToady proportions have a go at explanation. :-)
19:29 ruoso heh
19:29 * ruoso really got to go
19:29 ruoso brb&
19:29 PerlJam yeah, I've got to get to work too
19:29 * PerlJam work &
19:33 TimToady I dunno, my proportions are rather skinny...
19:37 jisom joined #perl6
19:38 Limbic_Region My proportions are quite large these days.  "Success goes to your head, but happiness goes to your hips" - Tye McQueen
19:45 dlocaus break &
19:54 jferrero joined #perl6
20:02 TJCRI joined #perl6
20:04 rindolf joined #perl6
20:07 lorn joined #perl6
20:09 rindolf Hi all.
20:09 Coke joined #perl6
20:10 TJCRI left #perl6
20:11 Coke left #perl6
20:21 ruoso joined #perl6
20:21 * ruoso back
20:23 ruoso sub foo (|$capture) { say $capture[0] }; foo(bar());
20:23 ruoso is bar() execution lazy?
20:23 ruoso better put... my $a := bar();
20:23 ruoso does it execute bar?
20:24 ruoso or will it only execute when $a is used?
20:25 ruoso if the rlvalue of the binding is a capture, I would expect bar() to be executed during the binding only if I had
20:25 ruoso my $a := |bar()
20:26 ruoso so the binding would be a truly functional thing
20:27 ruoso otoh, this would mean that my $a := %a<b><c> wouldn't need to autovivify (except by being specced that way)
20:28 ruoso am I insane? or does it make any sense?
20:32 ruoso TimToady, what do you think # and sorry for being so picky today ;) I'm trying to realize how to proceed on yap6
20:49 justatheory joined #perl6
20:50 rdice joined #perl6
21:03 TimToady we are not that lazy.  bar() is invoked immediately, but may return its value lazily.
21:04 TimToady bbl &
21:12 jjore-w joined #perl6
21:17 [particle] @tell fglock jonathan++ implemented set_outer on Sub for parrot in r24453. have at it!
21:18 IllvilJa joined #perl6
21:33 tobeya joined #perl6
21:38 ruoso kp6: my %a; my $b = %a<b><c>; %a<b> = { 'c' => 1 }; say $b;
21:38 exp_evalbot r19309: OUTPUT[syntax error at position 22, line 1 column 22:␤my %a; my $b = %a<b><c>; %a<b> = { 'c' => 1 }; say $b␤                      ^ HERE␤]
21:39 ruoso kp6: my %a; my $b = %a{'b'}{'c'}; %a{'b'} = { 'c' => 1 }; say $b;
21:39 exp_evalbot r19309: OUTPUT[␤]
21:39 ruoso kp6: my %a; my $b := %a{'b'}{'c'}; %a{'b'} = { 'c' => 1 }; say $b;
21:39 exp_evalbot r19309: OUTPUT[␤]
21:39 ruoso pugs: my %a; my $b := %a{'b'}{'c'}; %a{'b'} = { 'c' => 1 }; say $b;
21:39 exp_evalbot OUTPUT[␤]
21:41 ruoso pugs: my %a; my $b := %a{'b'}{'c'}; %a{'b'} = { 'c' => 1 }; say $b; say %a{'b'}{'c'};
21:41 exp_evalbot OUTPUT[␤1␤]
21:41 ruoso pugs: my %a; my $b := %a{'b'}{'c'};$b = 2; say $b; %a{'b'} = { 'c' => 1 }; say $b; say %a{'b'}{'c'};
21:41 exp_evalbot OUTPUT[2␤2␤1␤]
21:42 ruoso is this correct?
21:43 ruoso pugs: my %a; my $b := %a{'b'}{'c'};$b = 2; say $b;say %a{'b'}{'c'}; %a{'b'} = { 'c' => 1 }; say $b; say %a{'b'}{'c'};
21:43 exp_evalbot OUTPUT[2␤2␤2␤1␤]
21:53 Pengwn joined #perl6
22:11 _sprocket_ left #perl6
22:18 Schwern joined #perl6
22:25 ruoso I think I got it...
22:26 ruoso if all the container value-fetching returns Captures, we can postpone the context coercion and use the values directly in case of bind
22:26 ruoso for instance
22:27 ruoso %a<b><c> would mean a lookup for b in %a which would return a capture. this capture would be coerced to hash and then subject to another lookup, now for 'c', but at this time, the resulting capture will feed the call to bind
22:28 ruoso which would then check for uninitialized and call autovivify on it, if that's the case, which would end building the hash recursively
22:28 ruoso if the target container is rw
22:29 ruoso the difference for a assignment would be in the last step,
22:30 ruoso where the assign code would coerce to the proper context and copy the value.
22:31 ruoso the thing in all the container operations returning captures is that they can be coerced to any context afterwards...
22:31 ruoso like my %a = %a<b>
22:31 ruoso this would coerce to hash after the lookup
22:33 ruoso or even
22:34 ruoso in sub/method call
22:34 ruoso sub foo ($a, %b) { ... }; foo( %c<d><e>, %c<d><f> );
22:34 ruoso %c<d><e> returns a capture, that in bind-time is coerced to scalar
22:35 ruoso %c<d><f> returns another capture, that in bind-time is coerced to hash
22:39 ebassi joined #perl6
22:40 ruoso maybe not...
22:41 ruoso the return for the container value-fetching return objects that behave like scalars
22:43 justatheory joined #perl6
22:44 ruoso I think the way I was thinking was right at the first place
22:45 TreyHarris joined #perl6
22:46 ispy_ joined #perl6
22:47 TreyHarris anybody have an example offhand of where paren-less control constructs wouldn't work in the Perl 5 grammar?
22:55 TreyHarris oh, i got it.  "if $var { foo }", is it "$var<foo>", or is it "if ($var) { foo() }"?
23:05 pugs_svn r19310 | ruoso++ | [yap6] getting closer to something rational in the autovivification and capture issue. see NOTES_AUTOVIVIFY.txt
23:09 * ruoso trying to get the ideas in order...
23:09 * ruoso giving up for today
23:25 DaGo joined #perl6
23:37 BinGOs joined #perl6
23:58 han_ joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo