What type functions mean on a language level

Q. Schroll qs.il.paperinik at gmail.com
Tue Jan 12 20:41:02 UTC 2021


On Wednesday, 6 January 2021 at 13:52:39 UTC, sighoya wrote:
> If we allow a __type__ in type position, indirectly or 
> directly, we're able to implement generics known from other 
> languages, e.g.:
>
> ```
> method(__type__ type)(type value){...}
> ```
> vs
>
> ```
> method(T)(T value){...}
> ```

Is this a suggestion or what you think the semantics' 
consequences are? Because I fail to see how the first one is any 
different from a template. If I replace `__type__ type` by `int 
i`, it is still a compile-time argument. In one instance, the 
value argument is (or represents) a type. That doesn't change the 
semantics, or does it?


More information about the Digitalmars-d mailing list