DIPX: Enum Literals / Implicit Selector Expression

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Thu Jul 7 17:54:31 UTC 2022


On Thursday, 7 July 2022 at 15:51:08 UTC, Nick Treleaven wrote:
> For non-virtual functions, just use a template function:
>
> ```d
> auto f(T)(T v)
> {
> 	static if (is(T : int))
> 		// insert code for f(int) overload
> 	else
> 		...
> }
> ```

This solution feels like a huge downgrade compared to existing 
functionality. Reminds me of php or javascript, plus you'd need 
to handle yourself error handling if arguments don't match.




More information about the Digitalmars-d mailing list