4 ms·
I don't understand defenses of programming languages which seem to assume that syntax isn't a central issue. Syntax is the central issue of a programming langua
by gbhn 12y ago
I don't understand defenses of programming languages which seem to assume that syntax isn't a central issue. Syntax is the central issue of a programming language -- they all have very similar capabilities, in the end (thanks Alan Turing), and the core of a language is in how those capabilities are expressed in the syntax.
If most people find the syntax any of {awkward, intimidating, unreadable, inscrutable, undesirable} then they won't use it unless they have to.
This means programming languages are path-dependent. Perhaps in a different world, lisp-type syntax is how people think about programming. Or maybe in a different world Haskell syntax is the norm. But we live in this world, and in this world, such syntax is pretty much all of the above. This makes it harder for people to read and understand programs written in those languages. Since that's ultimately the central point of a programming language -- to make programs readable to human beings -- syntax is the primary thing on which languages are evaluated.
Obviously there are other factors like available libraries, tools, platform support, and so forth, but syntax is an extremely important pillar.
- mononcqc 12y agoSemantics is the central issue of programming languages, not syntax. The syntax defines the form of a valid program, but gives no information about what it means. Semantics define what the execution of that program would be. For example, 'X = X+1' can be valid by the syntax of two languages, except one of them (say Erlang), will fail to do the pattern matching defined under operator '=', whereas the other will do an assignment where 'X' is now worth its former value plus one. There is a lot more meaning and deeper implications to defining what 'x = x+1' means than defining how to write it. Another example can be '1 + 3 * 5': this is an addition and a multiplication, but what's the operator precedence? In smalltalk, it would be '(1 + 3) * 5'. In forth it has another entirely different meaning. You can think of it this way: Erlang the language can have a mostly-equivalent semantic set of operations in LFE, which is a lisp. It could have had semantic equivalence with Elixir's syntax, but it didn't (because Elixir made different decisions with re-binding and whatnot). Even if Erlang had Elixir's syntax, it doesn't mean you'd have to stop caring about: pattern matching, recursion, shared-nothing, etc. Syntax is important, but it's not nearly as important or challenging as semantics are.
- rdtsc 12y ago> Syntax is the central issue of a programming language As a sibling post mentioned, syntax is like a paint job. Yeah a pink tank is not appealing to everyone. . looks better than ;. Some like {}, some like begin/end blocks. That is syntax. If that is unsurmountable and is the central issue for that developer that is a sign they probably will not handle well a whole new paradigm (actors, distribution, distributed systems issues etc). Another level is what does the language operate with. This is after the syntax has been parsed. What are the building blocks: functions, variables, records, processes, ETS tables, messages, OTP behaviors, macros. Those are things that define a language more than Syntax. These can be familiar or unfamiliar. Like I see a class in C++, Java and Python. The syntax to define one is different but in my head I can conceptualize it in a similar way. Erlang is functional and concurrent. So those two things will make it unusual. It also operates with immutable, single assignment data. That is unusual. I can see someone having a gripe with that. As a mental experiment, if we switch all the . to ; and introduce {} brackets. Rename records to structs maybe or give them a C/Go like definition syntax. There won't be a revolution and Google, Facebooks other companies and universities will all of the sudden flock to it. They won't because they still have to use a new paragidm to develop -- processes and concurrency and single assignment variables. Yet another axis on which to judge syntax is consistent vs inconsistent. Erlang's syntax is unfamiliar but it is small and consistent. Same goes for the meanings of operations. Like say in Javascript if you watch the Wat talk, you'll how you add an object to some array for example and get a NaN. The syntax is familiar but the meaning and how it works is inconsistent. The same can be said about libraries as well.
- pessimizer 12y ago>I don't understand defenses of programming languages which seem to assume that syntax isn't a central issue. That's an unfair criticism of the defenses of Erlang vs. people complaining that the syntax doesn't look like C. I think Erlang's syntax is wonderful on it's own terms. Criticism of it because it doesn't look like C just seems like it's from lazy people who have a very narrow view of how programming should look. That's entirely separate from criticism by people like Tony Arcieri or Damien Katz, who criticize the syntax itself, rather than in comparison to some idea of what they think all languages should look like.
- klibertp 12y ago> but syntax is an extremely important pillar Syntax is important because of two distinct reasons. First is technical: how complex the syntax is impacts how fast, how many and how good tools (for refactoring, autocomplete, docs generation, macros and so on) will be created for the language. Second reason is sociological in nature, and also is further divided into two reasons, one reasonable and the other stupid. The first is that it's natural for people to use simpler things first. If the syntax involved in spawning a new thread is much more complex than the syntax for making and passing a callback you're going to end with most language users using event-driven, reactor based programming, even if launching a new thread would be more efficient (up to some threshold of difference in performance, above which people will feel it's worth it to use more complex feature). In short, syntax matters in that it statistically dictates how the language is used, which impacts what "best practices" and "idioms" are created. The second reason is idiotic and unprofessional. Imagine a carpenter who refuses to use a hammer because it has a pink handle, even if it's the only or the best hammer in some circumstances. Emotions felt towards tools - and specifically syntaxes - are what amateurs can get away with, but it's also one of the things which defines them as amateurs. The syntax is "awkward"? "intimidating"? ("unreadable" is a whole another can of worms) That's either funny or pathetic, depending on circumstances. If you are a professional programmer, you should be already at least comfortable with 5+ styles of syntax, including C-like, Pascal-like, Lisp-like and Prolog-like. This makes it impossible for any syntax to ever "intimidate" you.