Proposal: Package aliases
Bill Baxter
dnewsgroup at billbaxter.com
Thu May 15 16:12:21 PDT 2008
Robert Fraser wrote:
> Leandro Lucarella wrote:
>> It's like getters/setters, you can say: in Java I never need to write my
>> getters and setters because the IDE do it for me. In D you don't have to
>> write them either, and for that, you don't have to rely on an IDE and you
>> have shorter, cleaner code which is easier to read and maintain.
>
> Err.... you don't? The D convention is to use the property syntax, but
> you still need to write the methods.
In theory, you don't have to because you can just use public members
when you start out. Property syntax gives you a way to hide those
members later on if necessary.
In theory only, though, because properties and data members don't behave
exactly the same (can't use a property method as an lvalue; can't make
delegate of data member with &). To be *truly* future-proof you still
need to start out with your getters and setters, just like in C++/Java.
--bb
More information about the Digitalmars-d
mailing list