Reddit: why aren't people using D?
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jul 23 14:25:49 PDT 2009
On Thu, 23 Jul 2009 17:13:13 -0400, Bill Baxter <wbaxter at gmail.com> wrote:
> In any event I think a problem with this is that for D's simple
> grammar to remain simple and context free, get and set would both have
> to be made keywords in the language. Can a compiler guru confirm
> that? Not a big issue, but introducing 3 keywords for this one
> feature will be a tough sell. Perhaps just
>
> property int length {
> () { return this.len; }
> (newLen) { this.len = newLen; }
> }
>
> would be enough. Maybe I'm wrong about get/set being an issue, though.
I think you might be wrong. operator functions like opAdd are not
keywords, but are treated specially by the compiler. The compiler would
probably just change the get and set functions into mangled symbols that
would never be generated from a normal function, so no keywords would be
required.
-Steve
More information about the Digitalmars-d
mailing list