Skip to main content.

Thursday, November 22, 2007

I've always been a bit doubtful about "," (commas) being used as list separators in Falcon. One of the goal of Falcon language design was that of reducing the needless token to the minimum, and possibly to 0. So, a call like

call( alpha, "Beta", 3, 4 )

May be written as

call( alpha "Beta" 3 4 )

without any degrade of information. I also checked the compiler bison code, and found out that it would be actually simpler (and so, faster) not having commas around. Finally, a comma-less list grammar would make Falcon arrays look very lisp-like:

[iff [a] [b + 1] [c] ]

which never hurts.
Minor problems as the fact that two contiguous strings are now interpreted as a single one, so that

"f" "s"
"t"

is interpreted by falcon as "fst" can be easily overcome by i.e. interpreting at lexer level immediate string concatenation so that:

"f"+"s"+
"t"

would cause no actual code to be passed to the parser except for "fst".

The thing that is stopping me from removing commas is 1) usage pattern on similar languages and 2) (and most important) readability.

Contrarily to e.g. lisp, Falcon has infix expressions. Compare:

[iff a > 0 a + 1 a - 1]

with

[iff, a > 0, a + 1, a - 1]

No doubt that the compiler is able to understand the first sequence, and that the "," are not adding any information, but they separate the token at a visual level, and also provide some room to prevent stupid errors as i.e. adding an operator to the end of an expression:

[iff, a > 0, a + 1 +, a - 1]

This would cause a compilation error, while

[iff a > 0 a + 1 + a - 1]

would go unnoticed despite it's an evident error.
I accept comments...

Comments

No comments yet

Add Comment

This item is closed, it's not possible to add new comments to it or to vote on it