DIP26: properties defined

Robert jfanatiker at gmx.at
Sun Feb 10 03:04:16 PST 2013


> You must be able to rely on front always being used without parens,
> and you 
> must be able to rely on front() doing a call on the return value
> rather than 
> simply calling front.

Why? Think about it, this thinking comes from the fact that it was
considered to be a good idea that front could be anything including a
field or even an enum. The question is why would we want to allow this
in the first place. It is never used in the standard library, it breaks
encapsulation and every field or enum can easily be turned into a
trivial function.

Maybe you are still referring to an early version of the DIP where I put
there a sentence, (with a bad feeling already) that properties must not
be called with (). I fixed this very bad mistake very soon afterwards,
maybe you want to have another look?




More information about the Digitalmars-d mailing list