Of course precedence of the operator also must be informed by the operator
author to the compiler in some ways. Operator has different purpose and
workflow from function/method. If not, then everything can be just a method, no
operator needed.
However, if this is not practically possible in FPC, it’s all right then.
Thank you.
–Mr Bee
Pada Minggu, 2 Februari 2020 08.32.23 WIB, Sven Barth via fpc-pascal
<[email protected]> menulis:
Mr Bee via fpc-pascal <[email protected]> schrieb am So., 2.
Feb. 2020, 02:11:
Hi all,
Besides overloading available operators, could we make our own custom
operator(s) in FPC?
For example, I want to use ∑ to sum array values? Also other Unicode characters
such as ≥, ≤, ±, ≠, etc as custom operators? I think such feature is important
in this unicode era.
Is it possible?
No, it is not (okay, technically, in theory it would be possible, but
definitely not desired). The compiler would need to know such operators so that
it can determine the precedence. You can just as well use methods/functions for
that with the added benefit that they can be named in a way that explains their
purpose.
Regards, Sven
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal