The Wrong Stuff

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Oct 25 08:38:39 PDT 2010


On 25/10/2010 16:01, Michel Fortin wrote:
> On 2010-10-25 10:32:45 -0400, Bruno Medeiros
> <brunodomedeiros+spam at com.gmail> said:
>
>> On 26/09/2010 14:26, Michel Fortin wrote:
>>> Unfortunately, one attribute with the @ syntax in D -- and I'd say the
>>> flagship one as it was the first and most discussed -- is not a pure
>>> annotation as it has a noticeable effect on semantics. I'm talking about
>>> @property which, if it ever get implemented, changes your function so it
>>> simulates a field. In Herb's terms, @property is clearly a keyword in
>>> disguise.
>>
>> You don't want attributes to affect semantics? That's odd, it seems to
>> me the most useful scenarios for @attributes is actually to affect
>> semantics, and they're somewhat limited otherwise.
>> I mean, what exactly do you mean by "effect on semantics" ?
>
> What I meant is that @property actually *changes* the semantics: calling
> the function becomes a different thing and the function lose its regular
> semantics. Other attributes only *restrict* existing semantics, they
> don't change the existing semantics beyond making illegal some things
> which are normally legal.
>

Hum, I think I see what you mean. That being the case, I agree, if an 
@annotation radically changes the nature of whatever is being defined, 
it probably should not be an @annotation.
But I don't agree with Herb Sutter's comment that "Attributes are 
acceptable as pure annotations, but they should have no semantic effect 
on the program.", at least as applied to D. Just the fact that C++'s 
attribute are 4-characters extra (compared to just 1 in D, or Java for 
example) makes the comparison not very valid. I also would not like to 
have [[override]] [[pure]] [[safe]] , etc. in D.



-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list