Suggestion: properties should be treated as 'virtual members variables'
Marcio
mqmnews123 at sglebs.com
Tue Sep 5 09:57:05 PDT 2006
Kristian wrote:
>
> In digitalmars.D.announce there has been discussion about why you cannot
> use properties as data members.
Personally I like the Eiffel approach of not requiring () when calling
a method that does not need parameters. This allows the implementer of
the class to switch between a plain slot or real code that gets run to
compute&return, without impacting clients. No modification is needed at
the source code level at client classes. Users just say a.foo and the
foo implementer can choose the best implementation approach. No
complicated notation to define it "as a property" etc.
It is true that you can't assign to it to change it (a.foo := 3), you
still need the method call notation (something that properties do for
you, that extra syntax sugar). Some people like it better this way, some
people prefer being able to assign (conceptually).
marcio
More information about the Digitalmars-d
mailing list