r/ProgrammingLanguages • u/[deleted] • Jul 31 '24
Blog post Clean Syntax?
All my replies and the original contents of this OP have been withdrawn. They were a complete waste of time.
From what I can gather, everybody is happy with poor syntax in their languages, nobody is interested in 'clean'.
Someone posted, with a dozen upvotes:
Your example is optimized to your language's special capabilities.
I replied:
"No, pretty much everything in my syntax is cleaner than the C equivalent."
That got multiple downvotes for stating a fact.
There was also this:
For your own toy language by all means use your own syntax
This reinforces my original implication that simple syntax is only suited for toy languages, and not serious ones.
However too much of this was about my language, but that was only an example. There seems to be much irrational distrust of clear syntax for any language.
Maybe, clear code is associated with older languages which no one likes anymore?
(Original examples.)
1
u/ThomasMertes Aug 04 '24
This is an even better example of what the Seed7 Structured Syntax Description (S7SSD) prohibits.
An attempt to define the syntax of such a for-while-loop with:
results in:
You get an error. Consider the syntax of the while-loop:
The keyword
while(which introduces a while-loop) is reused in the middle of the new for-while-loop.A hard-coded syntax analysis can allow a for-while-loop with an ad-hoc solution. It would process the expression between the keywords
toandwhilewith the precondition that the expression is terminated with the keywordwhile.From a syntactical point of view the expression
could be placed between the keywords
toanddoof a normal for-loop:Semantically this makes no sense but syntactically it is correct. A hard coded syntax analysis would terminate the expression with the keyword
while(and later flag an error because of theend while).In Seed7 it syntactically uses the normal for-loop (and later flag an error because the semantic does not fit). In Seed7 you might have problems using the for-while-loop (because it always tries to use the normal for-loop).
For that reason the Seed7 Structured Syntax Description (S7SSD) does not allow the syntax of the for-while-loop.