property syntax strawman
Michel Fortin
michel.fortin at michelf.com
Sun Aug 2 04:33:23 PDT 2009
On 2009-08-02 06:27:27 -0400, Michel Fortin <michel.fortin at michelf.com> said:
>> bool empty{}
>>
>> i.e. the {} means the getter is declared, but defined elsewhere.
>>
>> What do you think?
>
> I'd prefer this, which can't be misinterpreted as an empty statement:
>
> bool empty { ... }
In the same vein, I'm now realizing that "bool empty {}" syntax for a
declaration is also a little dangerous and inconsistent: contrary to
other functions with a return value, the compiler can't issue an error
to say you forgot to return a value if you leave the body empty, it'd
silently transform it to a declaration instead.
Again, the elipsis solves this.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list