Define a new custom operator in D Language.

bachmeier no at spam.net
Mon Oct 2 21:37:56 UTC 2023


On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote:

> Overloading seems to only overload behaviour of existing 
> operator, like:
>
> ```
> +	-	*	/	%	^^	&
> |	^	<<	>>	>>>	~	in
>
> ```
>
> I'm unable to see how the operator overloading would allow to 
> define a new custom  operator.

And I don't expect that to change. This has come up many times. 
For example, 
https://forum.dlang.org/post/mailman.178.1688747876.3523.digitalmars-d@puremagic.com

> Operator overloading in general is provided so that 
> user-defined types can be used like built-in types and work 
> with generic code that uses those operators. Domain-specific 
> language stuff should probably be left to either a 
> domain-specific language or just use properly named functions.


More information about the Digitalmars-d-learn mailing list