I'm currently designing a database query language and I came to wonder what should be the best syntax for the comparison operator.
Most modern languages use
==, but amongst the database languages based on SQL the
= is also often used.
I acknowledge that the
= should have been the comparison operator whereas affectation might have been something like
<- if languages had follow a more mathematic syntax, but I guess languages like C have contribued to make
= for affectation a standard.
However, I'm not looking for a debate on what should be the best operator for affectation or comparison, but to know if using the same operator for two distinct things like MySQL and some other languages do is a practice to banish.
In terms of language design, using
= could be a bit annoying since it is source of grammar ambiguities, since this operator is also used for affectation. MySQL seems to solve this ambiguity by introducing the
SET keyword but in my case I don't see the point of introducing a new keyword where I can simply use different operators for affectation and comparison to remove the ambiguity.
So my question is : is there a real benefit to use
= as comparison operator considering it is already used for affectation ?