Page 1 of 1

Shouldn't JOIN { } return DEE ?

Posted: Thu Jan 30, 2014 5:03 pm
by blambeau
It seems that it returns a single TUPLE{} for now.

Also JOIN{} = DEE returns the following error: ERROR: Operator 'OP_EQUALS(TUPLE {}, RELATION {}) RETURNS BOOLEAN' has not been defined.

Am I misunderstanding something here?

Re: Shouldn't JOIN { } return DEE ?

Posted: Sat Feb 01, 2014 12:39 am
by Dave
The JOIN operator is overloaded to support both tuple join and relation join. As JOIN {} is ambiguous as to whether it means tuple join or relation join, it arbitrarily defaults to tuple join. Thus, the result of JOIN {} is TUPLE {}, so JOIN {} = TUPLE {} returns true, but JOIN {} = DEE fails because there is no definition for the '=' operator that permits comparing the tuple result of JOIN {} with the relation that is DEE.

Admittedly, this is perhaps a violation of the Principle of Least Surprise. I probably should make JOIN {} mean relation join.

Re: Shouldn't JOIN { } return DEE ?

Posted: Sat Feb 01, 2014 9:14 am
by blambeau
Interresting. Thanks for the explanation.

For the record, I was actually reading Hugh's book because I use it, and Rel, with the students at the University of Louvain. The example, and expectation, comes from what's written in the book. In that context, I would certainly say that it's a violation of the Principle of Least Surprise.

Re: Shouldn't JOIN { } return DEE ?

Posted: Sat Feb 01, 2014 3:54 pm
by Dave
I wasn't aware it contradicted Hugh's book. That makes it unquestionably a violation of the Principle of Least Surprise!

I've made an entry in my "to do" list to change this for the next update.

Re: Shouldn't JOIN { } return DEE ?

Posted: Tue Jun 17, 2014 2:46 pm
by HughDarwen
Tutorial D grammar doesn't include <n-adic tuple join>, so JOIN { } has to be a relation join, yielding DEE. What about UNION { }? That has to be an <n-adic tuple union> because if it were a relation union it would need a heading to be specified.

But apparently Rel doesn't yet support UNION { }, which is indeed defined to yield TUP{ }. Another one for the to-do list?

Hugh

Re: Shouldn't JOIN { } return DEE ?

Posted: Tue Jun 17, 2014 3:01 pm
by HughDarwen
Further to my reply just posted, I've just come across the point in my book where n-adic tuple join is indeed defined. But we didn't even have that in TD/V1, so my book has been in error all this time. Deepest apologies!

Hugh