On Tuesday, 18 July 2017 at 02:22:15 UTC, Jay Norwood wrote:
An excerpt statement from this wiki page is :
" dynamically dispatched based on the run-time (dynamic) type or, in the more general case some other attribute, of more than one of its arguments"

Based on the 'some other attribute', I wonder if the library could conceivably be extended to dispatch based on the User Defined Attribute info


@('c') string s;
pragma(msg, __traits(getAttributes, s)); // prints tuple('c')

For example, CLOS allows you to specialize on a value (google for "eql specialize"). IIRC Clojure allows you to specify your own dispatcher.

As for specializing on D attributes, I don't think it's feasible. They are a purely compile-time mechanism. In your example, the type of "s" is "string", not "@('c') string".


Reply via email to