Re:Syntax is the last thing you should design
by vidarh on Monday March 06, 2017 @03:15AM
(#13801416)
Is it a good syntax if it hides important details? To me that sounds like a bad syntax. I want a readable and beautiful and clean syntax, but that to me also implies making important details clear.
The most important purpose of syntax is to ensure semantics are presented in a clear, readable and consistent manner. If it hides important information, it fails in that.
Note that the languages I've complained about the syntax of in this discussion, such as Lisp and Forth, have very minimal syntaxes, and it may be that they are too minimal, but it is not that minimalism in itself I take issue with, but that the minimalism sacrifices readability. There are languages with small syntax I admire, such as e.g. Oberon (grammar fits in a page and a half of BNF), where the syntax is very focused on clarity - my ideals for syntax are orthogonal to size/complexity.
A good syntax could easily hide semantic warts that cause far more problems in real programming. If you focus on syntax too early, you're liable to introduce too many syntactic shortcuts to hide semantic ugliness when you should really address the problematic semantics.
For instance, Rust had lots of syntactic short hands to hide GC'd pointers, owned pointers, borrowed pointers and so on. These small syntactic conveniences produced some pretty code at small scale, but trying to compose independent programs using these concepts into larger systems caused all kinds of problems because of the non-compositional semantics. They ended up clarifying the semantics which led to dropping most of the special syntax for a clean core language, and now Rust is enjoying surging popularity.