Featured post
parsing - Why does C++ not allow user-defined operators? -
i've been wondering quite time. there whole bunch of them , can overloaded, why not end , allow custom operators? think great addition.
i've been told make language hard compile. makes me wonder, c++ cannot designed easy compilation anyway, undoable? of course, if use lr parser static table , grammar such
e → t + e | t t → f * t | f f → id | '(' e ')'
it wouldn't work. in prolog, parsed operator-precedence parser afaik, new operators can defined, language simpler. now, grammar rewritten accept identifiers
in every place operator hard-coded grammar.
what other solutions , parser schemes there , other things have influenced design decision?
http://www2.research.att.com/~bs/bs_faq2.html#overload-operator
the possibility has been considered several times, each time i/we decided problems outweighed benefits.
it's not language-technical problem. when first considerd in 1983, knew how implemented. however, experience has been when go beyond trivial examples people seem have subtlely different opinions of "the obvious" meaning of uses of operator. classical example
a**b**c
. assume**
has been made mean exponentiation. shoulda**b**c
mean(a**b)**c
ora**(b**c)
? thought answer obvious , friends agreed - , found didn't agree on resolution obvious one. conjecture such problems lead subtle bugs.
- Get link
- X
- Other Apps
Comments
Post a Comment