Ampersand
Ampersand copied to clipboard
proposal on introducing binary calculations in Ampersand
Now we have the REPESENT statement in place, I think it would be nice to introduce calculations. I have been thinking about this for some time now, and I want to share my thoughts on this with you all:
- Currently, we require that every relation is declared by the user. I suggest to introduce a well defined set of 'special' relation names, like _gT, _lT, _eQ_, with pre-defined semantics in Ampersand. These relations can be used in expressions, without the user having to declare them. (declarations by the user with these names might even be forbidden). (note that I do not intent to change the parser)
- The disambiguator will disregard these relations, somewhat the same as _V_ was used.
- An extra check (after disambiguation) will be introduced to check the compatibility of the represents of source and target. (at first, I suggest that the represents must be equal)
- In generating SQL, expressions containing these special relations are treated the way they are currently treated , except for the EDcD constructor. That is handled as EDcV, using a binary operator that depends on the semantics of the relationname.
These modifications all seem pretty straitforeward, I suggest to introduce a haskell data type for these pre-defined relations (to guarantee maintainability of it all).
I think this will allow us to experiment with binary calculations (Haskell type: a -> a -> Bool). It is not a solution however for calculations with another haskell type.
Please comment on this proposal (specially @sjcjoosten and @stefjoosten )