User attributes (was Proposal on improvement to deprecated)

bearophile bearophileHUGS at lycos.com
Mon Oct 3 11:36:29 PDT 2011


Piotr Szturmaj:

> for user defined attributes (I need to write DIP on that).

Please write that DIP :-) Even if it will be refused, it will be a starting point to build on successive better ideas for user defined attributes.


> There are of course many other possible use cases like Object/Relational
> Mapping, RPC/Remoting, debugger visualization overrides, hints for the
> GC, etc.

I see user defined attributes also as ways to extend the type system with in library/user code, a bit like dehydra/treehydra (but with no need to use another language to specify them). But I think more static introspection will be needed for that. I mean things like a __trait that given a function name, returns an array of the names of all its local variables, a __trait that tells if a variable used in a function is locally defined, globally defined, if it is static, etc. Some of such info is already present in the JSON documentation about modules. So a way to perform searches on such JSON at compile time will be useful. Eventually maybe even linear types or uniqueness types become implementable with annotations.

Bye,
bearophile


More information about the Digitalmars-d mailing list