develooper Front page | perl.perl6.language | Postings from April 2003

Re: Properties & Methods

Thread Previous | Thread Next
From:
Luke Palmer
Date:
April 8, 2003 15:37
Subject:
Re: Properties & Methods
Message ID:
ygcadf0zkcm.fsf@babylonia.flatirons.org
> On Tue, Apr 08, 2003 at 03:10:35PM -0400, Dan Sugalski wrote:
> : At 11:26 AM -0700 4/8/03, Larry Wall wrote:
> : >On Tue, Apr 08, 2003 at 11:01:24AM -0400, Dan Sugalski wrote:
> : >: At 12:12 AM -0600 4/8/03, Luke Palmer wrote:
> : >: >In this case it would be great to have lexically and dynamically
> : >: >scoped properties.  So:
> : >:
> : >: Gah! No! Nononononononono! Have I mentioned I'd rather not?
> : >:
> : >: Lexically and dynamically scoped *methods* I can manage, as that's
> : >: just a layered namespace issue, and that's no big deal. Lexically and
> : >: dynamically scoped *properties*, though... Yowtch.
> : >
> : >But what if you just think of the property as a method on a singleton 
> : >class?
> : 
> : Then I have to completely rip out the current property system, 
> : property introspection becomes much harder, and the property hash you 
> : mandated doesn't work well any more.
> 
> What if the property hash by definition includes the names of all
> public methods that are rw and argumentless?  

I'm starting to almost completely dislike this.

What if lexical properties don't show up in the property hash, much as
lexical variables don't show up in the package symbol table.  What
properties a sub has assigned some object isn't really anybody else's
business anyway.  There's the advantage of being able to clean up a
property after there's no references to it that aren't on a variable.

But the analogy breaks down at %MY.

And again, dynamically scoped properties are a different kind of
bear.

> Then we have the delightful benefit that a method definition can be
> inserted to turn a passive property into an active one without
> changing the source code that calls it.  If a class wants to fudge
> its definition of "true", it can...

Hmm, I'd hate to be the generic programmer handling classes like that.
But I guess the idea is that I wouldn't... they'd inflict whatever
misfortune became of that upon themselves.  That's really The Perl
Way, come to think of it.  'Nuff rope to hang yourself with.  Right.

Luke

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About