What have you done with UDAs?

Manu via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 22 16:44:31 PDT 2015


On 23 June 2015 at 05:09, weaselcat via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> I never seem to use them for anything, has anyone else done anything
> interesting with them?

I've used them for attributing struct members with some information
about their semantic meaning, which allows systems to automatically
bind those structs to useful functions.
For instance, I have attributed color structs with information about
the D3D or OpenGL format spec's that represent, I have done the same
with vertex data, expressing the semantic meaning of the elements in
the vertex struct, so they can be bound automatically to the
appropriate shader inputs. I've used it for control over serialisation
of data in structs. I've used it to tag information to struct fields
that are to be exported to editor environments, and control how those
properties should be represented in editors (pretty-names, type of
editor (select box, color picker, etc). I've used them for giving
information to automated bindings for scripting systems. Particularly,
I use them to tell automated systems to consider or ignore certain
things.


More information about the Digitalmars-d mailing list