On 4/20/04 2:37 PM, Larry Wall wrote:
> On Tue, Apr 20, 2004 at 01:15:24PM -0400, John Siracusa wrote:
> : With that "has" line alone, you auto-magically get an accessor that works
> : like this:
> : 
> :     $obj.foo    # get value of $.foo
> :     $obj.foo(5) # set $.foo = 5
> 
> I don't care what syntactic sugar you put underneath, but if you expose
> this interface to the user, it's fundamentally flawed.  This is my
> argument from the Apocalypse, and it hasn't changed.  It's wrong
> to introduce a fundamental asymmetry that breaks the contract that
> an accessor can be used as a variable.

Er, I think we have different definitions of "accessor."  I'm perfectly
happy to never allow anyone to do $obj.foo = whatever.  I just don't want to
write trivial methods that get and set an attribute behind the scenes.

-John

Reply via email to