Zcoin implementation bug enabled attacker to create 548, 000 Zcoins
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Sat Mar 11 11:39:32 PST 2017
On Sat, Mar 11, 2017 at 01:46:31PM +0100, Timon Gehr via Digitalmars-d wrote:
> On 10.03.2017 23:41, H. S. Teoh via Digitalmars-d wrote:
> >
> > Basically, operator syntax is just too specific to the arithmetical
> > meanings of the operators that overloading them to mean something
> > else seems like just asking for trouble.
>
> OTOH, restricting how operators can be overloaded means they cannot be
> used for symbolic mathematics, which is annoying.
I think you misunderstand my intent. By "arithmetical meanings" I meant
any meanings to which mathematics may assign to said operators, so using
"x + y" for vector addition, for example, is fair game. And perhaps even
field addition for general fields. But using "x + y" for division is
abusive, for example, and so is using "+" for appending to a file.
But in any case, this isn't something that's enforceable. Deciding
whether an implementation of an overload of "+" is "addition-like" is
probably undecidable. It's just bad practice to use "+" for something
that someone reading the code wouldn't expect. The bottom line is really
readability and maintainability than anything else.
T
--
My program has no bugs! Only unintentional features...
More information about the Digitalmars-d
mailing list