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] = $
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, dependin
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
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 co
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 take
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 wrote:
> Larry Wall wrote:
>> Moritz Lenz wrote:
>> : Either it's parsed as '@a[0] = (W, W)' (l
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',
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
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 @a[0]