On Sat, May 19, 2001 at 06:41:29PM +1000, Damian Conway wrote:
>
> Graham wrote:
>
> > On Fri, May 18, 2001 at 10:36:59PM -0400, John Siracusa wrote:
> > > > print keys $foo.prop; # prints "NumberHeard"
> > > > print values $foo.prop; # prints "loneliestever"
> >
> > This is an example of one of my concerns about namespace overlap
> > with methods. What would happen if there was a method called prop ?
> > Have we basically said that there cannot be a method called prop ?
>
> No, we have basically said that there cannot be a method called prop if you
> want to access the object's properties through its prop property.
Which mean that any class which defines a method prop, prevents any user
from determining the properties of any of its object instances.
I am not saying that this is a bad thing, but it will need to be docuemnted
that doing this has such consequences. Unless there is another syntax
for determining all the properties of a value.
> > Personally I would rather see something other than . for accessing
> > properties. As things stand the functionality of a working
> > program can be completely changed/broken by defining a sub that
> > conflicts with a property.
>
> Er...yes...that's rather the point of the exercise: to be able to
> polymorphically override the behaviour of properties by defining
> methods.
I am just not conviced that it is a good thing todo. methods and properties
are different things.
Graham.