Most Perl 6 will look like Perl 5

Adriano Ferreira a.r.ferreira at gmail.com
Fri Jan 25 15:07:42 GMT 2008


On Jan 25, 2008 10:42 AM, Andy Wardley <abw at wardley.org> wrote:
> Abigail wrote:
> > Third, there's no auto-quoting inside the curlies, you have to be explicite.
>
> That really sucks.  I never quote my values unless they need quoting.  It
> saves so many characters that otherwise just get in the way.  It seems rather
> contrary to the Huffman coding principles that Larry is such a fan of.
>
> > will now become C<< %hash{'key'} >>.

If you use curlies, you will have to be explicit just as Abigail said.
But as Mark mentioned, for literal keys this Perl 5 syntactic overload
should be changed to use <> instead.

                %hash<key>

which is coherent with other uses of <> as a quoting mechanism.

              <a b c>   is  'a', 'b', 'c'
              :k<val>    'k' => 'val'    (constructing a Pair)

And there is also the interpolating counterpart indexing

                %hash<<user {$foo+1}>>

which is equivalent to     %hash{ "user {$foo+1}" }

That means Huffman coding is still there, but distinct things were
made different as many others in Perl 6 (for instance,

* eval {} vs eval STR, which are now    try {} vs eval STR
* x for strings and lists, which are now two operators   1 x 3 (=
'111')  1 xx 3 (= 1, 1, 1)

)

> Will you be able to use the dot operator like this?
>
>    %hash.key

You could, but I am not sure you should ;-) Subclass the hash
container and create an automethod which returns the stored value at
the given key.

> That would be better Huffman coding IMHO.
>
> A
>


More information about the london.pm mailing list