Michael G Schwern <[EMAIL PROTECTED]> writes:

> On Thu, Sep 14, 2000 at 02:19:38PM +0100, Piers Cawley wrote:
> > Michael G Schwern <[EMAIL PROTECTED]> writes:
> > >     package Dog;
> > >     use fields qw(this night up);
> > > 
> > >     my Dog $ph = [];
> > >     $ph->{this} = "that";
> > 
> > That works? I thought you had to do:
> > 
> >       my Dog $self = fields::new('Dog');
> 
> Nope.  fields::new() basically just does C<bless
> [\%{"$class\::FIELDS"}], $class>, but the current pseudohash
> implementation doesn't care if something is an object or not.  It just
> cares about either A) its type or B) what's in $ph->[0].  I don't know
> if this is a good thing or a bad thing, but there's nothing on the
> table to change it (yet).
> 
>     my Dog $ph = [];
>     $ph->{this} = "that";
> 
> deparses at compile-time to:
> 
>     my Dog $ph = [];
>     $ph->[$Dog::FIELDS{this}] = "that";  # actually the %FIELDS lookup is also
>                                          # done at compile time, but I left
>                                          # it in for illustration.

Hmm... it still feels like undocumented behaviour. I'd definitely be
inclined to tighten up the base/fields behaviour. My feeling is that
the proposal makes them closer to the Right Thing.

-- 
Piers

Reply via email to