4 ms·
> Did you encounter any trade-offs or downsides in choosing this over a traditional s-expression style lisp? No downsides for `f[x]` instead of `(f x)`. It rea
by djedr 5y ago
> Did you encounter any trade-offs or downsides in choosing this over a traditional s-expression style lisp?
No downsides for `f[x]` instead of `(f x)`. It really does fix the problem of overnesting without any significant trade-off that I can see. Net value of this improvement is the highest.
For `foo | bar` instead of `foo[bar]` I see some downsides from a minimalist point of view. Slight complexity is added to the parser. The `|` is right-associative which has to be kept in mind when reading the code:
foo | bar | baz
might be less clear/more difficult to grasp for somebody who is learning the language than:
foo[bar[baz]]
As for the zero-argument sugar `foo!` -- its value is marginal, so also might not be worth it from a minimalist point of view.
> I am curious why this hasn’t been seen in a mainstream lisp before.
Not sure. Certainly I have not seen this exact improvement anywhere before or since. I think it's mostly a matter of tradition. Somehow S-expressions stuck as the defining feature of Lisp and a fundamental ALGOL-like change like that would be too much to stay in the family, certainly not in the mainstream.
Indeed, as @wgoodall01 mentions there is the Wolfram Language based around something similar to M-expressions, but it is neither mainstream nor (classified as) a Lisp. The syntax is also more complex overall.
There is also Rebol[0] and its variants, but it is also not mainstream and diverges from Lisp substantially.
Nothing else of note comes to mind.
I think John McCarthy had the right idea with M-expressions. Perhaps the definition should have been a bit more minimal back then and today we would have a major Lisp with this sort of syntax.
[0] https://en.wikipedia.org/wiki/Rebol https://en.wikipedia.org/wiki/Rebol