Is there any chance to introduce concepts/traits/typeClasses in dlang?

sighoya sighoya at gmail.com
Sun Dec 15 20:07:35 UTC 2019


> That is the static introspection capabilities.
> For dynamic:
>
> // typeof(input) is still templated, its just hidden, since 
> only the template arguments need deducing
> InputRange!ElementType map(alias func)(auto:InputRange input) 
> if (...) {
> 	struct Voldemort {
> 		...
> 	}
>
> 	return ...; // auto construction of an InputRange instance 
> with deduction of what ElementType is.
> }

Im not quite aware of the meaning of auto:InputRange but in my 
eyes it is static dispatching too, I find it equivalent too:

InputRange!ElementType map(alias 
func,ElemType)(InputRange!ElemType input){...}



More information about the Digitalmars-d mailing list