Maurice Lombardi wrote:
I have a smilar problem with complex type. Since gpc does not implement LongComplex types, I use the CEPHES library which contains (in C) all needed functions, and make interface with the attached import unit.
LongComplex is also such a beast. I've thought about adding it (and possibly ShortComplex, though I don't know if there's a real need for it), but so far I've shyed away because of the complexities ;-) involved.
One reason for adding it would be consistence, since we have Real, LongReal and Complex already, so I might accept it for this reason ...
This is, provided the backend handles LongComplex sufficiently (for the basic arithmetics). I haven't checked this. According to the documentation, I think it should (also complex integers, but that's yet another story ...).
OTOH, it might be worth considering if it's possible to move the whole complex numbers out of the compiler. (Of course, provided we have user-defined conversions, here Real -> Complex.) Even if the basic operations would have to be written as operators, this might not have to be less efficient than done by the backend (provided we have inlines in GPIs ...). And cases such as Real * Complex (which are currently poorly optimized) could be improved just by supplying a respective operator.
With C++ objects one can give such rules in constructors, by defining several constructors which differ by the types of their arguments. But this is valid only in objects, which are heavy structures. So we begin to imagine a new language.
That it's valid only for objects in C++ doesn't mean that it would have to be so in Pascal. (But as I said in the other mail, it's complicated, anyway.)
Frank