On 2011-10-05 09:54, Walter Bright wrote:
On 10/4/2011 2:46 AM, Jacob Carlborg wrote:
What are the thoughts around here on function names containing arbitrary
symbols, like in Scala. Example:

void ::: (int a) {}

This, in effect, means "user defined tokens". The lexing pass will then
become intertwined with semantic analysis. While possible, this will
make the compiler slow, buggy, impossible to run the passes
concurrently, hard to write 3rd party parsing tools, etc.

Yes, exactly. I suspected that would be the answer because of how D works. If we instead look on Scala, where everything is a an object and every operation is a method call.

3 + 4

Is interpreted as

3.+(4)

It's the same with "regular" methods

instance bar 4

Is interpreted as

instance.bar(4)

Does Scala have the same problem? To me looks as at least lexing could be completely separated. Then it's up to the parser to figure out that "3 + 4" is syntax sugar for "3.+(4)" which is a regular method call.

--
/Jacob Carlborg

Reply via email to