Up to now, GPC supports overloading of binary operators like `+' and user-defined operators such as `Foo', but also only as binary operators. I propose to extend and generalize this mechanism, e.g. to unary operators.
Besides the usual unary operators like `+' and `-', you can define your address operator as `@' (BP compatible) or `&' (like in C) or whatever you prefer. Also other C operators like `++' can then be easily defined without the need to have them built-in.
A special case would be the `^' operator since it's used both prefix (in pointer type definitions) and postfix (in pointer dereferences). I'm still thinking about the syntax for the operator declarations, but `operator ^ (...)' and `^ operator (...)' would seem to be the most obvious choices.
Some time ago, someone asked for backslash interpretation in string literals. Redefining the `'' (i.e., single quote) operator would make this easy. Also, the BP operators `#' and `^' (as in `^C') for character constants could be defined in a similar way, without messing up the syntax when they're built in.
The same applies to BP's `$' for hex integer constants. But, OTOH, friends of the C syntax could define `0x' for hex and, if they like, they could even define the `0' operator for octal constants.
Those who've always complained about Pascal's verbosity, could finally define the `{' and `}' operators as `begin' and `end' (preferably after defining the comment operator to `(*', `//' or whatever they prefer). And those who would prefer `;' as a statment terminator (as in C) instead of a statment separator can simply redefine this operator.
Back to binary operators, apart from `:=' (as recently requested), also `,' would be a very interesting one. We could have all the interesting properties of this C operator in Pascal.
Overloading `[' (for self-made arrays) and `.' (for records/objects) would work like in C++, of course, and can probably be used to implement Delphi-compatible object properties without further compiler support. Perhaps we can even define `class' as an operator (that inherits from `object', and `^') to provide for classes with implicit references.
The `_' operator could be defined to be rejected in identifiers in classic Pascal (so we don't need the explicit compiler checks we have now), whereas, e.g., international letters can be allowed in identifiers by defining them as new operators.
Overloading the `if' operator could be useful to make a new conditional syntax -- perhaps with `endif' to avoid problems with dangling `else' etc.
By overloading `const' to `var' for typed arguments, BP's "typed constants" could be supported without any contortions in the compiler.
Finally, overloading the `operator' operator seems very interesting, but I'll have to work out the details.
Frank