November 06, 2012
Am 06.11.2012 09:26, schrieb Walter Bright:
> On 11/6/2012 12:20 AM, Sönke Ludwig wrote:> But shouldn't we keep the syntax closer to normal attributes and other
>> languages(*)? I see a lot of arguments for doing that, with the only counter-argument that they would be in the same namespace as the built-in attributes (which should not be that bad, as this is very low level language stuff).
>>
>> (*) i.e. @mytype or @("string") and without the '[]'
> 
> 
> We can debate the syntax. I don't have a store set by this one. I was more interested in getting the semantics right. Anyhow, it's nice to have a working prototype to experiment with rather than a paper airplane.

Definitely! Thanks a lot for tackling this, to me this seems like something that can get a real killer feature for the language!
November 06, 2012
On Tuesday, 6 November 2012 at 08:39:47 UTC, Jakob Ovrum wrote:
> On Tuesday, 6 November 2012 at 07:55:51 UTC, Walter Bright wrote:
>> -snip-
>
> It doesn't look like it would be possible to schedule any runtime code using this, meaning they're not usable for stuff like registering types for serialization support, or doing runtime linking when attached to a function pointer, etc.
>

Runtime arrtibutes can be implemented as properties in object.d. This would work for classes only and for other types it can be implemented manually. Runtime attributes require substantial amount of work, introducing bugs, bloating ABI and new questions about how this feature does work with others.
November 06, 2012
On Tuesday, 6 November 2012 at 08:50:32 UTC, Walter Bright wrote:
> To emphasize, the User Defined Attributes thing is completely a compile time feature. However, a user defined runtime system can be built on top of it.
>
> It gives the best of both worlds.

Problem is that there's no way to do this without having the user specify which modules it should work for, like:

import attributes;
import a, b, c;

static this() // This code cannot be automated.
{
    initAttributes!a();
    initAttributes!b();
    initAttributes!c();
}

November 06, 2012
On Tuesday, 6 November 2012 at 08:56:26 UTC, Maxim Fomin wrote:
> Runtime arrtibutes can be implemented as properties in object.d. This would work for classes only and for other types it can be implemented manually. Runtime attributes require substantial amount of work, introducing bugs, bloating ABI and new questions about how this feature does work with others.

I'm not suggesting runtime attributes should be part of the language, nor am I suggesting we add them to Phobos.

All I'm saying is the UDA system has to be powerful enough that it *could* be implemented in a library if desired.

November 06, 2012
Am 06.11.2012 09:49, schrieb Jakob Ovrum:

> But, I yield until someone comes up with actual examples of how
> these UDAs are useful, because I can't think of anything
> interesting at the moment. I guess I should go read over the old
> discussions you linked (I remember participating, but can't
> remember any specifics).

you're just to deep catched in the .Net-Everything-Is-Done-In-Runtime-Paradigm - thats all :)

most of the stuff .Net does in runtime is not absolutely needed at runtime - but they need to because there is no compiletime reflection system available at all - and that trains developer to always thing in runtime-aspects - always

November 06, 2012
On Tuesday, 6 November 2012 at 09:03:49 UTC, dennis luehring wrote:
> you're just to deep catched in the .Net-Everything-Is-Done-In-Runtime-Paradigm - thats all :)

No.
November 06, 2012
On Tuesday, 6 November 2012 at 08:55:06 UTC, Sönke Ludwig wrote:
> Am 06.11.2012 09:26, schrieb Walter Bright:
>> On 11/6/2012 12:20 AM, Sönke Ludwig wrote:> But shouldn't we keep the
>> syntax closer to normal attributes and other
>>> languages(*)? I see a lot of arguments for doing that, with the only
>>> counter-argument that they would be in the same namespace as the
>>> built-in attributes (which should not be that bad, as this is very low
>>> level language stuff).
>>>
>>> (*) i.e. @mytype or @("string") and without the '[]'
>> 
>> 
>> We can debate the syntax. I don't have a store set by this one. I was
>> more interested in getting the semantics right. Anyhow, it's nice to
>> have a working prototype to experiment with rather than a paper airplane.
>
> Definitely! Thanks a lot for tackling this, to me this seems like
> something that can get a real killer feature for the language!

@test
void myUnittest()
{

}

Uh yeah, that would be awesome!
November 06, 2012
Am 06.11.2012 10:04, schrieb Jakob Ovrum:
> On Tuesday, 6 November 2012 at 09:03:49 UTC, dennis luehring
> wrote:
>> you're just to deep catched in the
>> .Net-Everything-Is-Done-In-Runtime-Paradigm - thats all :)
>
> No.

ok not you - but many others

November 06, 2012
Wow! This is an early christmas gift.

Just to be sure. Is the following also possible:

["Serializable"]
class Foo
{
   int bar;
}

This will attach the UDA to the ClassDeclaration.

The examples you've shown only attach UDAs to variable declarations.

/Jonas

November 06, 2012
On 11/6/2012 12:49 AM, Maxim Fomin wrote:
> On Tuesday, 6 November 2012 at 07:55:51 UTC, Walter Bright wrote:
>> snip
>
> Nice to hear because it was unexpected and was requested prevously by community.

I've been intending to do it for a while now.