[fpc-pascal] Custom operator

Sven Barth pascaldragon at googlemail.com
Sun Feb 2 02:31:53 CET 2020


Mr Bee via fpc-pascal <fpc-pascal at lists.freepascal.org> 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

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200202/3776cfda/attachment.html>


More information about the fpc-pascal mailing list