[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: '__iter', yet again!
- From: Petite Abeille <petite_abeille@...>
- Date: Wed, 16 Dec 2009 21:21:44 +0100
On Dec 16, 2009, at 9:08 PM, Cosmin Apreutesei wrote:
>> f( 'foo', nil, 'bar', nil )
>
> That n is exactly what I would've scrapped.
You cannot just scrap that as it tells unpack how long your list of argument is. Without it, you could never properly unpack arguments with nils.
Consider:
print( #{ 'a', nil, 'b', nil } )
> 1
Therefore:
unpack( { 'a', nil, 'b', nil } ) would pass only the first parameter if not told otherwise.
So:
f( 'a', nil, 'b', nil ) != f( unpack( { 'a', nil, 'b', nil } ) ) = f( 'a' )
f( 'a', nil, 'b', nil ) = f( unpack( { 'a', nil, 'b', nil }, 1, 4 ) )
- References:
- Re: '__iter', yet again!, Jerome Vuarand
- Re: '__iter', yet again!, Luiz Henrique de Figueiredo
- Re: '__iter', yet again!, steve donovan
- Re: '__iter', yet again!, Javier Guerra
- Re: '__iter', yet again!, Mark Hamburg
- Re: '__iter', yet again!, Cosmin Apreutesei
- Re: '__iter', yet again!, Petite Abeille
- Re: '__iter', yet again!, Cosmin Apreutesei