Tim M wrote:
On Sun, 16 Nov 2008 05:22:24 +1300, dsimcha <[EMAIL PROTECTED]> wrote:

== Quote from Tony ([EMAIL PROTECTED])'s article
Is D today's PASCAL?
Tony

No.  D is not a bondage-and-discipline language.


I think you're thinking of Java. Those guys are shit scared of public properties. Get & Set for everything.

You can't have fields in an interface.

Fields can't be overridden, and you can't add validation to them. (In D, you can use invariants, but they won't tell you what set this field to a bad value.)

The only way to get this behavior in Java is with get/set methods.

This is a case of syntax driving design patterns. In C#, I see people using properties rather than fields everywhere, but I'm starting to think that's bad form. Unless you're using interfaces or doing validation, something interesting like that, just use a public field. In Java, that'd be an expensive change to make; in C# or D, it's cheap.

Reply via email to