The problem with @properties in D

Don nospam at nospam.com
Tue Dec 13 10:02:46 PST 2011


On 13.12.2011 17:03, Robert Jacques wrote:
> On Tue, 13 Dec 2011 03:50:13 -0500, Manu <turkeyman at gmail.com> wrote:
>
>> On 13 December 2011 09:53, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
>>
>>> On Tuesday, December 13, 2011 07:28:18 F i L wrote:
>>> > Can someone please explain why @property and @disabled have a '@'
>>> > symbol in front of them?
>>>
>>> So that they don't have to be keywords.
>>>
>>
>> What is the rule for use of '@'?
>> It does feel inconsistent to me too...
>>
>
> @word are attributes. Attributes were added late to the D language in
> order to minimize the effects of adding new keywords,

That isn't true. Reducing keywords was NOT presented a primary rationale 
for adding attributes.

  so there are some
> keywords (i.e. pure) that might have been considered for attribute
> status had they been incorporated after attributes were available. At
> one point in time, user defined attributes were to be allowed but that's
> still on the enhancement list. We haven't gone back and normalized the
> older keywords as that would result in the pointless breaking of
> existing code.

I think the answer is simply: yes, it is inconsistent.

I don't think there's any justification for it. The "breaking code" 
argument is spurious, there's hardly any extant code from that era which 
hasn't already been broken. Note that the decision to retain the 
inconsistency dates from *before* TDPL was published.

It's just inconsistent. It's stupid that's inconsistent, but it's not 
terribly important.


More information about the Digitalmars-d mailing list