Michel Fortin wrote:
On 2010-01-27 15:54:42 -0500, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:
Now @property is in. That has created (as I had anticipated) the
unresolved issue of choosing between @property or just function for
any given parameterless function. Also I need to litter my code with
@property. To this day I am not sure whether we made the right decision.
Well, perhaps it'd be better if it was 'property' instead of
'@property'. I find the distinction between keywords and attributes to
be pretty arbitrary, almost illogical.
I'm on the side that attributes (those keywords starting with @) should
be reserved to things you can ignore entirely without preventing the
program from working. For instance, remove all @safe and @trusted
attributes from a program and it still works with no change in behaviour
(except for when an error occurs). 'nothrow', 'pure', 'final',
'deprecated' should be attributes; '@property' should be a regular
keyword. Protection attributes could be made attributes too since if you
remove them all everything still works.
So I think attributes should be reserved to non-essential but useful
stuff in the language, generally those things adding restrictions
without changing the semantics.
This was actually discussed before, and I think the general conclusion
was that there is no useful definition of @attributes that includes
@property.
I think I have an idea quite similar to yours, only slightly more
specific. I'll post it in a new thread.
-Lars