Choosing a Language Based on its Syntax?
15 points by gingerBill
15 points by gingerBill
People seriously think the declaration syntax is what gives a language its “character”. I do not get this train of thought in the slightest.
In principle, you could mostly slap any style of syntax onto any style of semantics and get a language out that works. However, people do not encounter a uniform random sample of all possible syntax/semantic combinations.
There are only a small handful of successful languages in wide use. Each of those languages is part of a lineage that directly inherits both syntax and semantics from previous languages. Their designers worked hard to make the language successful by appealing to users that already knew some other language.
Thus, in practice, there is a strong positive correlation between the syntax of a language and its underlying semantics. If you see a language that syntactically looks a lot like, say, Java, then the designers probably deliberately mirror both Java's syntax and semantics in their language.
Since syntax is by necessity absorbed before the semantics, it makes since that users treat syntax as a signal for the semantics.
I don't disagree but there is a reason I focused specifically on declaration syntax and not anything else. Take Odin for example, it has every other construct which is familiar in an C alternative (e.g. if, for, switch, {} blocks, etc), but virtually no one comments on the syntax of them being "different" but I have seen people comment on the difference of the declaration syntax.
It's completely true that syntax is a good heuristic for semantics, but in this specific case, it rarely is and why I focused on it. I understand not everyone will understand that point, but it is still amazing people will not even use a language based on that even if nothing else indicates differing semantics.
onto any style of semantics
As a concrete example, as a (historic?) vehicle of PLT exploration with parsing taken care of, Lisps give you all possible semantics (which is sometimes confusing) from Haskell-style type-magic in Coalton to APL-style array programming in Lispe, from Prolog-style logic programming to straight C. It's magical what throwing Lisp syntax over any given semantics and concrete language implementation can do, like Fennel.
Sounds a lot like someone's opinion, for stressing how little opinions matter.
The point is that if you are designing something:
Look for the opinions of people that you do value and deem to be of worth, not some rando’s off the internet.
And this applies to anything kind of design, not just programming languages. It's not that opinions don't matter, it's that you cannot trust everyone's opinion equally.
Every language gets a novelty budget. If you want people to use your cool new feature, you’ll get more adoption if you’re conventional in other places.
A man must be orthodox upon most things, or he will never even have time to preach his own heresy. - G.K. Chesterton
Welcome to Odin's problem of not having any "Killer Feature".
But in the case of declaration syntax, people actually don't want "novelty", they want something that is familiar, and anything that is not familiar is deemed as bad and thus will be instantly ignored by kinds of people I was writing about. Even if the different approach might be better in general if that individual was willing to actually try.
100% agree.
I think one reason that so many devs take potshots at languages based on their syntax is that there’s a drive to have “a take” on everything, especially if that take is negative, even if the speaker is completely ignorant of the thing being discussed. I don’t know anything about Odin, but I can look at some Odin code and find some reason to have a preference. If I express that preference loudly enough I might even get some upvotes for it.
This applies to more than just syntax. Devs will loudly object based on vague notions of paradigm as well. Any language or framework labeled OOP or FP can trigger a storm of discussion, without the specific details of the thing actually having any bearing on the conversation.
(Copy/pasted from my Reddit comment on this article because I unfortunately saw it there before I saw it here)
there’s a drive to have “a take” on everything
I suspect a lot of this is driven by information overload. The Internet inundates us with stuff and it's hard to move on from one piece of information to the next without reaching some kind of conclusion or opinion. But since there is such a firehose to get through, we just can't allocate a lot of time to each and end up compelled to jump to shallow conclusions.
I agree with that too. I love programming languages and I’ve had to come to the conclusion that I use the one that I do because it’s familiar, and because I get paid to use it, and specifically not because it’s the language I would enjoy the most or be the most productive in. The feeling is… unsatisfying, at best, to know that there are better things out there and that I’m not learning or using them for pretty superficial reasons. I’d rather feel kind of bad about it though than to lie to myself (and others) that there’s something inferior about the languages and tools that I choose not to use.
We have to make decisions about what to engage with off of partial information all the time, but I think that it’s very easy to look for justifications for these decisions that sound more definitive than they really are. It’s the tendency to take those shallow justifications overly seriously (and to spew them online) that I think is the problem here.
I think that's oversimplifying it a bit. Some things are just not great with syntax and while it may in the end be not leading to anything, tone policing valid criticism doesn't feel good.
A lot of it can be fixed with tooling these days. I never liked the difference between . and -> for members in C++ but every modern-ish IDE just autocorrects you if you didn't think before you typed.
Yes, there's a lot of useless stylistic criticism, but there are also things that make language annoying to type on non-US keyboards and I don't think that's on the user. (As I only use 3 common layouts the example with ^ does not personally annoy me a lot, although it's not optimal.) And sometimes it's the dreaded legacy code. No one really liked \ for namespaces in PHP but (iirc) the parser wasn't fit to accept the proposed : or ::. It can be both valid to choose something bad and to criticize it.
I don’t think I’m “tone policing” anything here. It’s totally possible to have valid criticisms of most things in this world, including programming language syntax. But the blog post is about people judging a language as a whole on a very shallow basis and I think a major contributing factor is the very common pattern of developers looking for reasons to bash on technology which they don’t know very well. You mention PHP; I have seen dozens of comments online about how terrible PHP is because it uses sigils for variables and therefore is ugly. I don’t think any of the comments were by people who have done serious work in the language. I see the same thing with JavaScript, with reams of people posting the “wat” talk but unable to discuss the kinds of rough edges that actually occur in practice when using the language.
You say “it can both be valid to choose something bad and to criticize it, and I agree but I’d go even a step further. I really only care about criticisms by people who have a solid basis for their decision making in the relevant area, and the #1 way someone can gain this basis is to actually choose and use the technology.
Guess it was a bad choice of words, sorry. I didn't mean you specifically either, not even sure which sentence I was referencing (just reread your comment). I guess some sort of syntax criticism can be valid though, it's not like some users use the language more than the creators.
Coincidentally, I was bitten by one thing in the wat talk just last year, so well...
Syntax doesn't matter until it does
And those little things you mention do add up. With Odin, I made it so you don't have to make an explicit distinction like C/C++ and you can just . if you want most of the time. I also even mention Odin's use of ^ and why it is in practice not a huge problem. All of which I mention in the article.
I've tried a lot to make Odin one of the most ergonomic languages to use without having way too much syntactic noise (leading to syntactic diabetes). And getting very comfy feel requires getting rid of these minor syntactical and semantic issues, and tweaking others so that you don't notice things. I could write a book on all of this, and I'd been willing to talk about it in a different place, but this article wasn't meant to be that, it was just meant to be on a specific kind of programmer and how they evaluate things very shallow and naïvely.
Because this came up recently, and I didn't see the distinction in the comments yet. Also, I am not a PL person, but play one at work.
Syntax matters because Rice's theorem tells us we can only be certain about syntactic properties of languages, not semantic properties. You should totally choose a language in no small part based on its syntax, because it is unclear that a language can guarantee too much about its semantics other than what derives from its syntax. For example, Rust's type safety derives from its syntactic properties, rather than any further analysis based on semantics. SQL has weak syntactic guarantees (e.g. around types, nullability, errors) and often relies on semantic passes to kinda sorta conclude things about your query, maybe.
I think the article really means to lay in to folks who choose based on concrete syntax rather than abstract syntax, and no strong feels there. But very strong lived feels that syntax does matter (just maybe not concrete syntax, ymmv).
Rust's type safety derives from its syntactic properties
You mean lifetimes derived from lexical scoping? That's not really a syntactic property though. Languages with very different syntax than Rust also have lexical scoping.
SQL has weak syntactic guarantees (e.g. around types, nullability, errors
None of those are syntactic guarantees though. Eg, nullability has nothing to do with syntax. There are nullable values in languages with diverse syntaxes.
I do agree that syntax matters. It's why I have spent a hell of a lot of time on Odin's syntax. One of the headings is "Syntax doesn't matter until it does" is a subtle point I don't go into because I am focusing on the shallow naïve positions I've seen. There are loads of points about syntax which are absolutely necessary to get right and be good, but people don't even get into that, they just say it looks different to what they know and then completely ignore it, and not the general syntax, just the syntax for declaring variables.
And it's not even "concrete syntax" it's literally "familiar concrete syntax" over "unfamiliar concrete syntax". Those kinds of people are really judgy.
n.b. this was not even Odin specific, I've see people say no to languages like Rust just because of the declaration syntax not being like C for instance. It's all perplexing to me being a professional programmer.