On Monday, 14 July 2014 at 16:10:59 UTC, Timon Gehr wrote:
Same principle of surprise minimization. Reader expects
arbitrary
actions done by function call.
No way.
?
Reader expects arithmetical semantics
Right, arithmetical semantics, which for built-in '+' can reach
from wrap-around behaviour to saturated behaviour which is not
even associative. Knowing what '+' does without being very
aware what types its operands are is a pipe dream.
I don't mean low level semantics, just very simple "this adds two
numbers" semantics - something you can ignore and abuse in D
(though I don't know if it is even possible to define such
constraints reasonably)
from arithmetical operations.
'+' is opBinary!"+" and it is just another function name. There
don't need to be 'anti-abuse' mechanics in place for this name
and not for others.
Do you like boost::spirit? :)
I don't see "you can change anything"
D does not allow you to e.g. redefine what the built-in
operators do on built-in types, so where is this complaint
coming from?
D is decent language in that regard - I am speaking about
imaginary language that does not constraint any semantics and
provides perfect expressive power.
Languages that do not make built-in operators syntactically
special are way better off regarding this issue because this
way the question of automatically limiting implementations to
match naming is even more obviously pointless.
You do realize this statement creates self-referential cycle and
is thus pointless? :)
In any case, what are you arguing against here? Lexical
scoping? Named definitions? Module systems? :o)
macros that can't be recognized as macros at call site based on
pure syntax