[fpc-pascal] commutative operators

Jetcheng Chu jcchu at acm.org
Thu Dec 30 05:57:37 CET 2010


I think you need to make sure that `a' and `b' are in the same algebraic
system before making the commutativity of the operator meaningful.
Maybe you can merge `one_type' with `another_type' into a common type,
or cast one to the other?

----- Original Message -----
Subject: [fpc-pascal] commutative operators
From: David Emerson <dle3ab at angelbase.com>
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Time: Wed, 29 Dec 2010 10:38:14 -0800
MUA: KMail/1.9.9

> suppose I define an operator:
> 
> operator + (a: one_type; b: another_type) : one_type;
> 
> Is there any way to specify that it should be "commutative", so I don't have to 
> additionally define the reverse:
> 
> operator + (a: another_type; b: one_type) : one_type;
> 
> Thanks
> ~David.
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
Best Regards,
J.-c. Chu



More information about the fpc-pascal mailing list