Re: Clarification of S04 closure traits

2009-07-28 Thread Ben Morrow
Moritz Lenz wrote: Ben Morrow wrote: - Presumably when an exception is thrown through a block, the LEAVE and POST queues are called (in that order). POST was inspired from the Design By Contract department, and are meant to execute assertions on the result. If you leave a block through an

confusing list assignment tests

2009-07-28 Thread Moritz Lenz
I'm in the mood to question my sanity, so I'm seeking feedback for some test mangling: In t/spec/S03-operators/assign.t there are some tests that cause me a headache. I'm trying to re-write them to not use the now-gone want() function, but I'd have to understand them first ;-) A good example is

r27784 - docs/Perl6/Spec

2009-07-28 Thread pugs-commits
Author: pmichaud Date: 2009-07-28 21:45:55 +0200 (Tue, 28 Jul 2009) New Revision: 27784 Modified: docs/Perl6/Spec/S04-control.pod Log: Fix incorrect specification of implicit $_ in blocks. Modified: docs/Perl6/Spec/S04-control.pod

Re: confusing list assignment tests

2009-07-28 Thread Larry Wall
On Tue, Jul 28, 2009 at 09:24:40PM +0200, Moritz Lenz wrote: : sub W () { substr(eval('want'), 0, 1) } : ... : : # line 560: : { : my @a; : my @z = (@a[0] = W, W); : #?rakudo 2 todo 'want function' : is(@a, 'L','lhs treats @a[0] as list'); : is(@z[0], 'L', 'lhs treats

Re: confusing list assignment tests

2009-07-28 Thread Jon Lang
Larry Wall wrote: Moritz Lenz wrote: : Either it's parsed as '@a[0] = (W, W)' (list assignment), then @a should : get both elements, and so should @z. Not according to S03, at least by one reading. �...@a[0] as a scalar container only wants one item, so it only takes the first item off the

Re: confusing list assignment tests

2009-07-28 Thread Moritz Lenz
Thanks for the quick reply. Larry Wall wrote: On Tue, Jul 28, 2009 at 09:24:40PM +0200, Moritz Lenz wrote: : sub W () { substr(eval('want'), 0, 1) } : ... : : # line 560: : { : my @a; : my @z = (@a[0] = W, W); : #?rakudo 2 todo 'want function' : is(@a, 'L','lhs

Re: confusing list assignment tests

2009-07-28 Thread Mark J. Reed
My understanding is that the P6 way to do that is to return a Capture containing the desired return values (which can lazily do things only when accessed) in the appropriate slots. On 7/28/09, Jon Lang datawea...@gmail.com wrote: Larry Wall wrote: Moritz Lenz wrote: : Either it's parsed as

Re: confusing list assignment tests

2009-07-28 Thread Moritz Lenz
Jon Lang wrote: Larry Wall wrote: Moritz Lenz wrote: : Either it's parsed as '@a[0] = (W, W)' (list assignment), then @a should : get both elements, and so should @z. Not according to S03, at least by one reading. @a[0] as a scalar container only wants one item, so it only takes the first

Re: confusing list assignment tests

2009-07-28 Thread Damian Conway
Mark J. Reed wrote: My understanding is that the P6 way to do that is to return a Capture containing the desired return values (which can lazily do things only when accessed) in the appropriate slots. Return a Capture or a more heavily overloaded object, depending on how fine a degree of

Re: confusing list assignment tests

2009-07-28 Thread Larry Wall
On Tue, Jul 28, 2009 at 01:22:28PM -0700, Jon Lang wrote: : Larry Wall wrote: : Moritz Lenz wrote: : : Either it's parsed as '@a[0] = (W, W)' (list assignment), then @a should : : get both elements, and so should @z. : : Not according to S03, at least by one reading. �...@a[0] as a scalar :

Re: confusing list assignment tests

2009-07-28 Thread Jon Lang
Damian Conway wrote: Mark J. Reed wrote: My understanding is that the P6 way to do that is to return a Capture containing the desired return values (which can lazily do things only when accessed) in the appropriate slots. Return a Capture or a more heavily overloaded object, depending on how

Re: confusing list assignment tests

2009-07-28 Thread Larry Wall
On Tue, Jul 28, 2009 at 10:42:01PM +0200, Moritz Lenz wrote: : I guess when I initialize @a[0] = [] it's the same, because then @a[0] : is still a scalar, right? No, as in Perl 5 [] still produces a scalar object that hides the arrayness from list context, so it's like: $b = []; @a[0] =