develooper Front page | perl.perl5.porters | Postings from March 2011

Re: Revising Perl's OO docs - a new OO tutorial

Thread Previous | Thread Next
March 7, 2011 23:27
Re: Revising Perl's OO docs - a new OO tutorial
Message ID:
On Mon, Mar 07, 2011 at 03:56:08PM -0800, Jan Dubois wrote:
> On Mon, 07 Mar 2011, Chris Prather wrote:
> > 
> > In my opinion you're moving from dangerous to useless at best. I feel
> > that the *semantics* of this syntax are confusing. They confuse method
> > dispatch with assignment*.
> I disagree.  The semantics of setting attributes/properties are the
> same as assignment:
> * setting the attribute multiple times to the same value is not supposed
>   to have any additional effect beyond what the first assignment did
> * the attribute is supposed to return the value it was last set to
> Attribute setters/getters are *not* supposed to be generic methods; they
> are syntactic sugar for assigning and querying values.
> And many languages (VB, C#, JavaScript, of the top of my head) all use
> assignment syntax for property manipulation.
> The fact that under the hood they all perform a method dispatch is an
> implementation detail that doesn't have to be exposed to the user.

I would go the other way. The fact that calling a method is implemented
as storing/fetching a value is an implementation detail that should not
be exposed to the user. Hence, it should not have a different syntax.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About