Proposal: user defined attributes

Ary Manzana ary at esperanto.org.ar
Thu Mar 22 06:31:25 PDT 2012


On 3/22/12 2:32 AM, Andrei Alexandrescu wrote:
> On 3/21/12 12:06 PM, Jacob Carlborg wrote:
>> On 2012-03-21 16:11, Andrei Alexandrescu wrote:
>> I think the liability here is that b needs to appear in two places, once
>>> in the declaration proper and then in the NonSerialized part. (A
>>> possible advantage is that sometimes it may be advantageous to keep all
>>> symbols with a specific attribute in one place.) A possibility would be
>>> to make the mixin expand to the field and the metadata at once.
>>
>> Yes, but that just looks ugly:
>>
>> class Foo
>> {
>> int a;
>> mixin NonSerialized!(int, "b");
>> }
>>
>> That's why it's so nice with attributes.
>
> Well if the argument boils down to nice vs. ugly, as opposed to possible
> vs. impossible - it's quite a bit less compelling.
>
> Andrei

Why don't you program everything with gotos instead of for, foreach and 
while? If it boils down to nice vs. ugly, as opposed to possible vs. 
impossible...

Hmm...


More information about the Digitalmars-d mailing list