2 ms·
Do you mean precedence or infix? The choice of infix vs prefix vs postfix is semantic. What s-expression syntax imposes is to have everything balanced between
by didibus 7y ago
Do you mean precedence or infix?
The choice of infix vs prefix vs postfix is semantic. What s-expression syntax imposes is to have everything balanced between brackets. For example, nothing prevents an S-expression based language to allow:
(2 + 3)
The only thing is there are no precedence rules, you must have parenthesis always:
((3 * 2) + 5)
- chrisseaton 7y agoWhy are you trying to explain s-expressions to me like I’ve never heard of them when I’m already in a thread debating their pros and cons for language design and implementation?
- didibus 7y agoI'm sorry that you are getting defensive and feeling like I'm attacking your expertise. But there's all kind of people with different experience levels on HN, so I prefer asking for clarification when I can instead of assuming things and talking over each other. If you truly meant precedence, well, I guess I disagree with you. Even in math, I prefer explicit parenthesised expressions for readability. If you meant infix, that's not a concern of s-expression so it's irrelevant to the syntax question. I know that personal preference is basically the reason for various syntaxes off course. But I think similar to how there's a movement that a common standard code formatting is better than everyone having their own custom formats, you could argue that having a common syntax which I think s-expression would make a great common syntax, could also yield an overall better outcome. And that's my argument here. Most languages have a: here's an s-expression based version of it. Like Python has Hy, Lua has Fennel, etc. So you already see a trend in how s-expression could easily cover all those languages, which is normal since they get closer to the parse tree anyways.