bitkeeper-scm / little-lang

The Little Programming Language
http://www.little-lang.org
215 stars 18 forks source link

. for concatenation #4

Open HalosGhost opened 8 years ago

HalosGhost commented 8 years ago

Like C, L concatenates adjacent string literals.

However, where C provides a string concatenation function, at the moment, L provides an operator for string concatenation: .

Overloading . in this way (so that the whitespace around it is syntactically meaningful) causes a few pain points.

E.g., where -> (which, at least in C, is equivalent to . but dereferencing its left argument before access) can be spaced however the user would like but . cannot be. Or, what happens when whitespace exists on one side of . but not the other?

I would propose one of two things:

  1. Use an alternative operator (e.g., $$, >< or ##; the latter might be good since C programmers already associate it with concatenation of a sort).
  2. Do not require an operator for string concatenation at all; L already allows for concatenation of string literals, why not just concatenate all adjacent strings?