From: "Nathan Wiger" <[EMAIL PROTECTED]>
Sent: Friday, September 29, 2000 12:51 AM
> James Mastros wrote:
> > As far as setting|getting, I'd like to make a simple proposal.  Consider
it
> > an idea for whoever writes the RFC (I'm looking at you, Nate)
> Oh, jeez, as if I didn't have enough already! ;-)
Well, you did rather say you did.

> > The idea is this: every variable should have a psudohash of attributes.
> Idea is good, implementation I think should be different. Especially
> since Schwern has professed "pseudohashes must die!".
Oh, sorry.  By psudohash I meant a hash that doesn't really exist as a hash
of it's own, not a hash that's really an array.

> > my $subsline = $&sub:{line};

> However, overall I think this should be hidden. The internal magic of
> attributes will likely not map 1:1 to hash keys, so requiring what is
> essentially an accessor function for these is probably a good thing.
The internal magic I don't know, but attributes, to me, seem close
enough to hashes that throwing away all the power of hashes seems
silly and unperlish.  (After all, an object is a ref, and a stack is an
array.)

Anyway, how do you do a foreach (keys attrib $scalar)?

Best of both worlds: Have attrib return a magicly lvalueable hash
(list) in one-arg form.

> That way, attributes can be applied to objects, packages, subs, and
> other things that don't have variable representations:
Hmm... I thought that a sub was a variable with a & funny-char (with
some oddities, such as &sub calling sub and giving that value, rather
then &sub itself), and "An object is simply a reference that happens
to know which class it belongs to".

As to packages, I'd set the attributes on their namespace hash --
%%package::name:::{'fluffy'}++;  (Three colons on the end.)
OK, that's pretty ugly, I'll admit, which is why the alternate syntax is
there.

> The declaration of attrs is proposed vaguely in RFC 337. I'll add access
> before the freeze.
Gah, I forgot that one.

Hmm, in 279, you propose a syntax like this:
LVALUE : ATTRIBUTE;

However, this syntax would make this:
$a[0] :32bit = get_val;           # 32-bit
reasonably mean
Get the current value of $a[0], set the 32bit attribute on it,
and then replace that value with the return of the get_val
function.

This would end up making $a[0] = get_val with no attributes,
since the return of the get_val function (assumedly) has no
attributes.

    -=- James Mastros



Reply via email to