custom attribute proposal (yeah, another one)
Steven Schveighoffer
schveiguy at yahoo.com
Mon Apr 9 06:02:27 PDT 2012
On Sat, 07 Apr 2012 09:59:27 -0400, Jacob Carlborg <doob at me.com> wrote:
> On 2012-04-06 19:36, Steven Schveighoffer wrote:
>> so now I must define a type for every attribute? I'd rather just define
>> a function.
>>
>> What if I have 20 string attributes, I must define a new attribute type
>> for each one? This seems like unneeded bloat.
>
> If we want to be able to pass a key-value list to the attribute, I think
> a struct is needed.
What if they have nothing to do with each other? What I'm getting at is,
I don't want to define a struct just so I can pass a string. It's
unnecessary.
> BTW, could both structs and functions be allowed?
Yes, I replied early on to Timon Gehr, this should be allowed. Simply
because a struct ctor is a function like any other function, called by a
standard D symbol. It doesn't make sense if you don't allow it, because
it's so easy to create a factory method that forwards to it.
-Steve
More information about the Digitalmars-d
mailing list