On 2015-03-30 09:06, Rikki Cattermole wrote:

You, me and Walter should have a chat then. I could pretty easily come
up with a way to add data into RTInfo.

I've already come up with a way, any template with the @rtInfo UDA is treated the same way as RTInfo is now. The problem is then how to store the data in TypeInfo. Since it would be possible to have multiple data generated for a given type I was thinking it could be stored in an associative array. The keys would be the name of the module which generated the data and the the values would be the data.

Something like this:

module foo.bar;

@rtInfo template Foo (T)
{
    enum Foo = "bar";
}

assert(typeid(T).rtInfo["foo.bar"] == "bar");

If I recall correctly Martin Nowak didn't like this approach. The associate array would need to be built at load time of the application due to separate compilation.

BTW, here [1] is the pull request and the reason why it was closed.

[1] https://github.com/D-Programming-Language/dmd/pull/2271#issuecomment-59621060

--
/Jacob Carlborg

Reply via email to