Re: [fpc-pascal] commutative operators

2010-12-30 Thread David Emerson
Mark Morgan Lloyd wrote: > Can I have a reality check on this please: in this context is the > overloaded := effectively an implicit cast as well as an explicit operator? looks like. Below is some sample code which illustrates the fact. > Is the availability of overloaded + and := operators nece

Re: [fpc-pascal] commutative operators

2010-12-30 Thread Mark Morgan Lloyd
Honza wrote: 2010/12/29 David Emerson : On Wed 29 Dec 2010, Honza wrote: IIRC you don't have to. well... I do have to. I get "can't determine which overloaded function to call" because I have a lot of similar-looking functions and := operators You're right, I verified it just now. I didn't re

Re: [fpc-pascal] commutative operators

2010-12-30 Thread David Emerson
On Wed 29 Dec 2010, Jetcheng Chu wrote: > 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. You know, that makes a lot of sense. I should have thought about it that way before asking. Thanks. ~David. ___

Re: [fpc-pascal] commutative operators

2010-12-29 Thread Honza
2010/12/29 David Emerson : > On Wed 29 Dec 2010, Honza wrote: >> IIRC you don't have to. > > well... I do have to. I get "can't determine which overloaded function to > call" > because I have a lot of similar-looking functions and := operators You're right, I verified it just now. I didn't remembe

Re: [fpc-pascal] commutative operators

2010-12-29 Thread Jetcheng Chu
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] commutativ

Re: [fpc-pascal] commutative operators

2010-12-29 Thread David Emerson
On Wed 29 Dec 2010, Honza wrote: > 2010/12/29 David Emerson : > > 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: > > > > op

Re: [fpc-pascal] commutative operators

2010-12-29 Thread Honza
2010/12/29 David Emerson : > 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; II