So, User-Defined Attributes

Jacob Carlborg doob at me.com
Sat Jan 5 09:00:28 PST 2013


On 2013-01-05 15:13, Philippe Sigaud wrote:
>
> Clojure uses its metadata (attached to values, though, not declaration)
> to put documentation strings there.
>
> That's quite doable with D:
>
> @(doc("This function does.... "))
> auto foo()
> { ... }
>
> I'm also interested in tagging data:
>
> @(Sorted!(withThisFun)) someRange ...
> @(Ranged(0.0, 1.0)) someRange ...

Just for the record, the extra parentheses are not needed:

@doc("This function does.... ") auto foo () {  }
@Sorted!(withThisFun) someRange ...

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list