operator overloading with conformant or open arrays?
Peter N Lewis
peter at stairways.com.au
Tue Mar 11 07:01:19 CET 2003
It seems it is not possible to use a conformant or open array to
operator overloading, ie:
operator + ( const s1: array[n1..m1: Integer] of char; const s2:
array[n2..m2: Integer] of char ) = ADD : Str255;
operator + ( const s1: array of char; const s2: array of char ) =
ADD : Str255;
both fail with "operator must have two arguments", presumably because
the conformant/open array passes hidden arguments for n1,m1 or
Is the error actually correct, or is the error just erroneously
complaining about the hidden arguments (since there are two real
If the latter, it'd be nice to get this fixed since it would make
porting of short strings a lot easier. If the former, are there any
plans to remove this restriction?
Failing his, if I have six or seven string types (of different
lengths), and I make an operator + and = for each pair, that is n**2
for each (perhaps 49 + operators and 49 = operators). Would doing
this be stretching the compiler beyond it's design or would it be a
perfectly reasonable thing to do?
Also, I noticed that := cannot be overloaded as an operator. This
would also be a handy addition, although quite possibly it'd have to
be a special case.
I did check the Todo list on the web page but did not see anything
related to this.
Thanks for any advice,
More information about the Gpc