r/ProgrammingLanguages • • 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.)

2 Upvotes

35 comments sorted by

View all comments

3

u/oilshell Jul 31 '24

One reason is that I don't use one programming language at a time, and I don't think most people do

I am always using some combination of languages (and DSLs)

And it helps if they have similar syntax. C, Java/Kotlin, JavaScript/TypeScript, R, and to some extent Swift and Zig and Rust are all sorta mutually readable, at least at the surface lexical level

Then you can spend your mental effort on the actual differences

Python would appear to be an "odd man out", but it's easy for me to switch back and forth between Python and C. I guess because I already indent my C code, so it's not hard for me to read indentation as significant

...

I don't think your syntax is unreadable -- it looks fine. Ruby and Lua also use "end". I can deal with that, but currently I don't have to

So basically I'd rather deal 2 things -- } and Python indentation -- rather than 3 things -- } and indentation and end

It basically doesn't matter to me, as long as the 3-4 languages I use regularly are roughly consistent. The more consistent the better.


YSH (of https://www.oilshell.org) looks like JavaScript and Python in many ways - https://www.oilshell.org/release/latest/doc/ysh-tour.html#hello-world-script

Because of course nobody can remember all of shell syntax ... :-P