Luke Palmer wrote:

> > More interestingly, it may also be that, by default, the C<operator:{}> (i.e.
> > hash-look-up) method of a class invokes the accessor of the same name as the
> > key, so that:
> 
> I'm a tad bit confused on the grounds of classes. Are we allowed to:
>   %fred = new Flintstone;

No. Not as you envisage it. Perl 6 objects aren't hashes.

> Or are class instances limited only to scalars? The former seems a bit
> counterintuitive...

Yep. Perl 6 usage in this respect will be like Perl 5 usage. The constructor of
a class will return a reference, which will normally be stored in a scalar.
The difference in Perl 6 is that the object is an "opaque type": not a hash,
not an array, not a scalar, sub, regex, glob, but a mysterious, encapsulated,
impenetrable something of type OBJECT.

The C<operator:{}> method of which I spoke is the perl 6 equivalent of the
C<FETCH> method of a tied hash (but without having the overhead of tying anything).

Damian

Reply via email to