Michel Fortin wrote: > On 2009-08-02 03:43:43 -0400, Walter Bright <newshou...@digitalmars.com> > said: > >> The alternative is to have a unique syntax for properties. Ideally, >> the syntax should be intuitive and mimic its use. After much fiddling, >> and based on n.g. suggestions, Andrei and I penciled in: >> >> bool empty { ... } >> void empty=(bool b) { ... } > > I like that. But then (just a question) can you do: > > void empty+=(bool b) { ... } > void empty++ { ... } > void ++empty { ... } > > ? >
If we apply rewriting rules to expressions that are mutated (either by a unary operator or by being the left-hand side of some kind of assignment expression) then we get these for free. I'd really like to /not/ have to define these extra operations. Otherwise we end up with one of the downsides of current operator overloads: defining all of them is a serious pain in the butt, and getting the compiler to define all of them for you is ugly.