> >There's two ways I've proposed in different RFC's. The first one
> >utilizes a more general framework; the second one depends on C<tie>
> >being used. A UNIVERSAL:: method wouldn't work because you've got to get
> >attributes from arrays and hashes as well.
> 
> Maybe I'm just being dense, but why shouldn't arrays and hashes inherit
> attributes from UNIVERSAL?  tie()ing an array is really just like being
> able to call object methods on it distinct from its members, no?  So arrays
> and hashes could be objects too.  Hmm, am I saying that I should be able to
> write @array->method()?

I think under tie this is *exactly* what we should be aiming for. I
think this is awesome.

However, making it a UNIVERSAL method also dictates that this:

   my SomeType @a :someattr;

*must* be either:

   1. a builtin type
   2. tied

To get its attributes back out. I'm not sure this is going to always be
true. In particular, what if SomeType was like "int", and you were just
trying to assert that each individual element was going to be SomeType?

If these problems were resolved, then I must admit to having a perverse
softspot for being able to say:

   my packed @bits :long;
   %attrs = @bits->attributes;

I dunno...I like the way that looks for some reason... ;-)

-Nate

Reply via email to