At 15:17 +0200 2/7/05, Waldek Hebisch wrote:
GPC uses `is' operator for this purpose. However, there are poblems:
- `is' was disabled for Mac Pascal
- `is' did not work for Mac objects (classes). Patch below add needed support.
- after adding {$define member(a,b) (a is b)} to your program (and with the patch) I get:
peterU2.pas:36: warning: `is' always yields `True' if the right operand peterU2.pas:36: warning: is the declared type of the left operand. peterU2.pas:38: error: right operand of `is' must be a derived type peterU2.pas:38: error: of the declared type of the left operand peterU2.pas:38: warning: `is' always yields `True' if the right operand peterU2.pas:38: warning: is the declared type of the left operand. peterU2.pas:39: error: right operand of `is' must be a derived type peterU2.pas:39: error: of the declared type of the left operand peterU2.pas:40: error: right operand of `is' must be a derived type peterU2.pas:40: error: of the declared type of the left operand peterU2.pas:41: error: right operand of `is' must be a derived type peterU2.pas:41: error: of the declared type of the left operand peterU2.pas:41: warning: `is' always yields `True' if the right operand peterU2.pas:41: warning: is the declared type of the left operand.
In particular, GPC considers `a is ObjectB' as error if ObjectB is not a derived class of class of a. While we may add some support for useless tests of this sort, it seems better to give error by default
I believe that is entirely acceptable.
Adriaan: Can you add "{$define member(a,b) (a is b)}" to your porting guidelines for CW -> GPC?
The patch appears to work (at least it compiles. 75 more units and I'll be able to start testing if it works ;-)
Thanks, Peter.