Idea to verify virtual/final methods

Jacob Carlborg doob at me.com
Tue Jun 4 06:28:14 PDT 2013


On 2013-06-04 15:15, bearophile wrote:

> My original purposes for UDAs was to extend the type system, as
> you have essentially done here. But to do that well enough the
> attributes need to be more active.
>
> An idea:
>
> struct Small(T) if (T.sizeof <= 16) {}
>
> @Small struct Bar {
>        int x;
> }
>
>
> Here Small get instantiated with T == Bar, and its constraint
> performs the active compile-time test.

Absolutely. My idea for AST macros, which includes integration with 
UDA's, could possibly solve that.

https://dl.dropboxusercontent.com/u/18386187/ast_macros.html

See the bottom for attributes.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list