Hello,
When overloading operators in a Delphi record, it is possible to specify a result type that the documentation does not recognize:
TCondRec = record
public
Text: string;
Params: TParams;
class operator LogicalAnd (aLeft, aRight: TCondRec): TCondRec; // return TCondRec instead of Boolean
class operator LogicalOr (aLeft, aRight: TCondRec): TCondRec; // here as well
This allows us to write expressions such as the below, to generate an SQL string as the result of joining `aLeft` and `aRight` with an `AND` or `OR` operator.
It seems this technique is internally used by EntityDAC components in order to provide an "SQL Builder", somewhat similar to the idea exposed here.
My worry however, is that this syntax showed above is not documented: according to the Embarcadero docs, these class operators are supposed to return a Boolean.
Here's some screenshots of what can be done:
The question is:
How concerned should I be about using such a library, in the eventuality that Embarcadero decides to enforce the syntax described by its documentation?
Or alternatively (if lucky), any chance the documentation itself is wrong? (docs are often known to be missing, maybe they just didn't write it correctly here?)
Thanks