Debating Syntax is Dumb

Syntax is the lowest form of critique. The lowest. I cannot take it seriously.

Anyone agree / disagree?

Having said that, perhaps Elixir’s biggest mistake was going for a Ruby-like syntax instead of a JS one… /* just kidding : ) */

Depends on the topic of the discussion. If we’re talking about beginner friendlyness and readablity I’d say syntax is very much a reasonable argument. As an extreme example elixir certainly beats brainfuck on that matter. Also given two languages being functionally equal but syntactically different I’ll always choose the more readable and/or familiar syntax.

On the other hand you’re correct that syntax is only a small part of judging the usefulness of a language, especially if we’re at a middle ground of familiarity to the syntax and not at the extremes (like again brainfuck).

4 Likes

Yep, correct, there is a place for syntax discussion and it’s right at the bottom of the list.

Which is basically what you imply, with

Tbh, for me the syntax is really important.
If it reads like rubbish, i take a quick step back.
Sure, there are other more important things, but syntax is a big one for me as a non-programmer.

3 Likes

Syntax is important.

Even though, languages are a tool for me and I usually pick the language/runtime that suites the problem to solve best (well, sometimes the decission is made by the businness people :frowning: ).

Still, if I have two screwdrivers, one with and old wooden handle and one with a super grippy rubber handle, I’d prefer the one with the more ergonomic rubber handle.

The handle of the screwdriver is like the syntax of a language.

5 Likes

Agreed, syntax is important, but the expressiveness of the language matters too. There are two factors that are important to me:

  • signal to noise ratio: e.g. semicolons - this is just plain noise; they do serve a purpose but I have a strong preference on languages that don’t have them
  • being explicit and terse: some languages trade one for the other (Ruby, Go, Java), just a few have them both: so far I’ve seen this in Elixir and Python
2 Likes

Have you tried XSLT?

Try it for a couple of weeks and see if you feel the same way :laughing:

4 Likes

Just reading XSLT made me have a horrible flashback. You gotta warn people.

5 Likes

The problem is that “rubbish” is entirely subjective:

  • if something “reads like rubbish” because it is inconsistent within itself then it is likely garbage
  • if something “reads like rubbish” because I’m simply unfamiliar with it but otherwise it proves to be entirely consistent within itself then it up to me to become familiar with it …
6 Likes

For me the important things are:

  • That the syntax complements the semantics of the language
  • That the syntax is consistent
  • That there are as few special cases as possible

Just looking at syntax is of little use. It is the big picture that matter.

Of course you can have a personal preference regarding syntax, but I rather program in a syntax I dislike that is consistent and well thought out then a syntax I like which isn’t.

To tie in to the thread: Debating syntax may be dumb but it is fun! :smiley:

2 Likes

Overall syntax is important. Details like do/end vs begin/end vs {} are truly irrelevant. (Or position of piped-in argument…)

(I once saw an anti-Ruby rant where the poster claimed that begin/end was a mistake because it was so horribly verbose compared to {}, and that was it for any chance of me trying to seriously understand his argument.)

1 Like

I think this S/N ratio mentioned earlier is a good point: you want maximum amount of information in shortest time. So you want syntax that packs everything into short and simple commands, with clear image what’s going on. E. g. OOP languages if not done correctly tend to force programmer to know entire structure, being stateless most of the time is preferable.

For me, immutability is a key - you cannot modify anything without explicit use of ‘=’, prevented many obscure bugs.

3 Likes

Wise words. When working on legacy apps or code I didn’t write I try to keep this in mind. Admittedly it’s not the easiest thing to do.

1 Like

I think syntax is important too, however I agree that debating it can sometimes get silly :lol:

For instance, if a language has clearly been influenced by language X, and the creator of said language, and many of its users, actually like the syntax of language X - then it’s a bit pointless ranting about how the syntax of language X sucks and things need to be more like language Y :101: particularly when you often find those who like the syntax of language X dislike the syntax of language Y :044:

2 Likes

I’d argue that if you don’t know at least 5 disjoint languages, then you should not argue syntax. Otherwise you’re just arguing what you’re familiar with and not true syntax.

6 Likes

Now you should code brainf*ck if that doesn’t concern you.

1 Like

I like a language that is economical with its tokens and accomplishes a lot with a chosen few applied in a consistent way. Smalltalk comes to mind and I do like it in part because of the syntax. But I think it’s because of what the simplicity means in practice as well. Not having a bunch of keywords that have to be kept in mind all the time frees you up to effectively design your own syntax. The syntax itself is just a few different ways to send messages, some necessary differences between classes/variables, etc., and that’s it.

When people try to create nice syntax by adding things it really can’t ever reach a good point.

With that said, I’ll take a language with keywords and a great way to express ideas (in f.e. a good type system) any day, because I think OP is actually pretty spot on. Syntax is nice to discuss because literally everyone can have an opinion, so it’s very inclusive, but at some point you have to get real and appreciate that we’re not just typing things, but encoding ideas, assumptions and guarantees. No amount of syntactical niceties can make up for a function head that can say literally nothing about what assumptions are made in the function.

1 Like

Having a reading disability, syntax makes a very big difference for me. A few notes about trying to read code:

  • Having non-word characters to make changes of context is huge. As in paranthesis around arguments.
  • Lots of nested {} are a struggle.
  • Nested flow control is hard
  • do/end vs {} is very helpful
  • I’m finally training my brain to read anonymous functions correctly after adopting the formatted that removes parens around the arguments
  • pipes allowing code on multiple lines is really big

I’m sure there is plenty more. Elixir is genuinely easier for me to read than a lot of code. Good thing I really like it, too.

2 Likes

This is really interesting. How do you find indentation based scope delimiters?

3 Likes

My mother (dyslexia) “reads” layout first. In the German language and with some major fonts, she is able to read most words without looking at the letters, because her brain is wired to recognize the shape and pattern of the printed word. For foreign words, fonts and languages she needs to manually “parse” the words, letter by letter, whispering them out.

4 Likes