On Fri, 2002-04-05 at 11:17, Nikola Janceski wrote:
> uh... '->' is used as a dereferencer also, but I also dereference my code as
> so..
> 
> $value = $$ref2hash{'key'};
> @slice = @$ref2array[0 .. 2];
> 
> I really need to find the time to read the Articles but between work and
> taxes....
> 
> 
<snip />

Ah, This is where YMMV.  I tend to write

$value = $ref2hash->{key};

If you use slices a lot you may or may not like the changes that are
coming.  Sigils always stay the same in Perl 6 so instead of saying
$array[0] you will say @array[0].  This obviously causes problems for
splice syntax.  Here is what the Larry had to say in Apocalypse Two.

<snip
href="http://www.perl.com/pub/a/2001/05/03/wall.html#rfc%20134:%20alternative%20array%20and%20hash%20slicing";>
We're definitely killing Perl 5's slice syntax, at least as far as
relying on the initial character to determine the context of the
subscript. There are many ways we could reintroduce a slicing syntax,
some of which are mentioned in this RFC, but we'll defer the decision on
that till Apocalypse 9 on Data Structures, since the interesting parts
of designing slice syntax will be driven by the need to slice
multidimensional arrays.

For now we'll just say that arrays can have subscript signatures much
like functions have parameter signatures. Ordinary one-dimensional
arrays (and hashes) can then support some kind of simple slicing syntax
that can be extended for more complicated arrays, while allowing
multidimensional arrays to distinguish between simple slicing and
complicated mappings of lists and functions onto subscripts in a manner
more conducive to numerical programming.

On the subject of hash slices returning pairs rather than values, we
could distinguish this with special slice syntax, or we could establish
the notion of a hashlist context that tells the slice to return pairs
rather than just values. (We may not need a special slice syntax for
that if it's possible to typecast back and forth between pair lists and
ordinary lists.)
</snip>
 
-- 
Today is Setting Orange the 22nd day of Discord in the YOLD 3168
All Hail Discordia!

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to