Suggestion: properties should be treated as 'virtual members variables'
Jarrett Billingsley
kb3ctd2 at yahoo.com
Tue Sep 5 10:23:25 PDT 2006
"Marcio" <mqmnews123 at sglebs.com> wrote in message
news:edka8t$2e0j$1 at digitaldaemon.com...
> 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.
But this _is_ how D does it right now, i.e.
class Foo
{
int bar()
{
return 4;
}
}
Foo f = new Foo();
writefln(f.bar);
Or even:
int foo()
{
return 5;
}
writefln(foo);
We're not happy with this, because of the expressivity that is lost when
using things like op=.
More information about the Digitalmars-d
mailing list