On Thu, Jul 23, 2009 at 2:25 PM, Steven Schveighoffer<[email protected]> wrote: > On Thu, 23 Jul 2009 17:13:13 -0400, Bill Baxter <[email protected]> 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.
That makes sense. Maybe Walter would like to take this opportunity to plug his upcoming compiler building seminar for us compiler ignoramuses. :-) --bb
