6 ms·
Whenever I look at all these old and new curly-brace languages, I imagine a world where they are different runtime libraries for the same language instead, and
by cousin_it 15y ago
Whenever I look at all these old and new curly-brace languages, I imagine a world where they are different runtime libraries for the same language instead, and no one has to learn the subtle syntactic differences introduced by the latest group of well-meaning overlords.
I mean, there's only one widely accepted way to write a "for" loop in a curly-brace language, right? Only one possible syntax for the ternary operator. One obviously right way to organize classes and imports. A couple competing ways to declare types (Foo foo or foo:Foo), but perhaps we as a community could make a bold choice just this once? One obvious syntax for generics, and so on.
The lowest common denominator I have in mind looks almost exactly like early versions of Java, except with optional typing ("var"), some rudimentary generics and without checked exceptions.
There seems to be no good reason for new languages like Dash to embrace a different style. And there's one big reason why you'd want source-level compatibility: polyglot libraries! For example, there's a rather huge open source library for dealing with geographical coordinate systems, basically a huge bunch of complicated math with almost no platform dependencies. How awesome would it be to have it compilable for the JVM, the CLR and the Flash player from the same source code?
I'd imagine many shops would jump at the chance to future-proof big parts of their code in this way. And the syntaxes are already so tantalizingly close to each other! Juuuust different enough to enable platform lock-in...
- ricardobeat 15y ago... Flash player?
- josephg 15y agoIt sounds like you're not looking for a bold choice; you're looking for language innovation to stop. The only widely accepted for loop syntax is the C-style for loop, which was invented 40 years ago and is vastly inferior to for..in loops, ruby's .each / .each_index and python's list comprehensions. That says nothing of generics[1]. The reality is, we can make much better languages today than Java or C#. [1] http://weblogs.java.net/blog/arnold/archive/2005/06/generics_consid.html http://weblogs.java.net/blog/arnold/archive/2005/06/generics...
- cousin_it 15y agoAs a consumer of programming languages, I'd like the evolution of languages in the mainstream to be less incremental and more punctuated. If you make a new language that's exactly like the old language but has a slightly tweaked syntax for one or two little things (e.g. changing the capitalization of the name of the string class), you're forcing lots of programmers everywhere to rewrite their code in the new flavor. You're forcing companies everywhere to spend more resources on hiring, retooling, etc. And you actively contribute to bitrot by weakening the incentives to keep old code running as-is on newer runtimes, because "no-one writes such code nowadays anyway". It's basically a lot of waste that could be avoided. The jump from C++ to Java was big enough: it introduced garbage collection, proper modules, proper strings and other nice things into the mainstream. The jump from Java to Python, if it happens, might be marginally big enough to merit rewrites (we gain many nice small-scale constructs like dicts, generators and list comprehensions, but lose the IDE tooling and guaranteed-correct refactorings enabled by static types). The jump from JavaScript to Dash doesn't seem big enough to justify all the busywork. Please come back in five years with more shiny things. ...A man can dream, can't he. Obviously the big guys will keep introducing new languages where a new library or a new runtime could've done the job. They have incentives to do so. But it's not so pleasant to the rest of us. You'll note that I have avoided using the word "innovation" so far. That is because genuine language innovation generally happens outside of the mainstream and takes decades to percolate. For example, the idea of list comprehensions is older than I am (NPL '77). For that matter, so is the idea of lazy pure functional programming (SASL '76), and the idea of parameterized types (ML '76), and any number of other ideas that people mislabel as "innovative" to justify creating new languages today. Adding 30-year old features into curly brace languages, bit by little bit, and forcing us to rewrite all our code at every step doesn't sound to me like the noble practice of innovation. It's more like a big coordination trainwreck.
- ehsanu1 15y agoAs a consumer of programming languages, I'd like the evolution of languages in the mainstream to be less incremental and more punctuated. While there is such a thing as punctuated equilibrium, I believe you'll find that evolution is largely incremental in nature. Seems like evolution simply has to happen this way, whether we're talking about biology or technology, including programming languages.
- gnaritas 15y agoYou presume syntax is like fashionable clothes all decorating the same basic thing underneath; that's not at all true. Syntax is a reflection of the underlying differences in semantics of these languages, they're not just decoration. You can write procedural C style in any language, but you're not really using the language if you aren't using its idioms which will inevitably reveal the reasoning of its syntactical choices. Lisp is a perfect example, as is Smalltalk.
- mibbit 15y agoBS. Syntax is exactly like fashionable clothes. It's irrelevant to how warm your clothes are. The number of developer years wasted coming up with yet another programming language or syntax is staggering. It's a solved problem. Pick an existing syntax and use it. You don't see people endlessly coming up with new syntax for math do you. We've got one, it works well, so we use it.
- ajanuary 15y agoThere are many mathematical notations for the same things, usually depending on the domain or different focus. Just like with programming languages.
- asynchrony 15y agoThere are more differences between steel-toed boots, sandals, and stiletto heels than just how warm they are. In modern times it is also rather rare to encounter individuals wearing togas and/or powdered wigs. I'm not convinced that fashion is a complete explanation for these phenomena.
- drothlis 15y agoChoice of syntax affects how easy it will be to create tools for the language (IDE syntax highlighting, code browsing/navigation, automated refactoring, etc). There is still plenty of room (and need!) for improvement, for innovation. At the other extreme, imagine a world where every language used C++'s syntax.
- 15y ago
- nopassrecover 15y agoFYI (based on comments in this thread made by you and others), C# is nothing like Java, despite similar C-derived syntax.
- haberman 15y agoThere is much much more to programming languages than syntax. If syntax was the main difference between programming languages it would be very easy to write translators from one language to another. Lots of people like their pet language more than JavaScript, so why don't we see tons of compilers like Python->JavaScript, Lua->JavaScript, Ruby->JavaScript etc? The answer is that syntax is just the tip of the iceberg. Even ignoring major language differences (garbage collection, static vs. dynamic typing, lexical vs dynamic scoping, eager vs. lazy, threads vs. coroutines) there is an incredibly long list of very detailed semantics that you probably don't even realize you're dealing with when you move from one language to another. For example: - in a complex inheritance hierarchy, which method is selected for a.b? - how much precision do numeric types have? - what happens when numeric types overflow? - what order are arguments evaluated in? - what happens if fewer arguments are passed than were declared? - are keyword arguments supported? - are default arguments supported? - when are default arguments evaluated? - are simple types like integer and string classes? - can they be subclassed? - can they be monkey-patched? - will types be implicitly converted? (ie 1 + "2")? - does 0 evaluate to true or false? what about "0"? - are function arguments passed by value or by reference? - are values hashed by their identity or by their logical value? - what hooks can you define to customize the behavior of your object? Nothing in this list is about syntax. Syntax is just the tip of the iceberg when it comes to what makes languages different.
- deleted 15y ago[deleted]
- cousin_it 15y ago> Lots of people like their pet language more than JavaScript, so why don't we see tons of compilers like Python->JavaScript, Lua->JavaScript, Ruby->JavaScript etc? Uuuuhhh, I'm really embarrassed to ask, but did you check with Google before posting that? "Tons of compilers" is exactly what we have now: https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS https://github.com/jashkenas/coffee-script/wiki/List-of-lang... . In fact my own job involves writing Java code that ends up being compiled to JS. I'd be overjoyed if such things were not necessary. I would even be okay with never using things like 1 + "2" or monkeypatching in 50% of my code if that made that 50% conform to some widely adopted cross-language standard. That would mean 50% less effort spent on any future rewrite. 50% less risk from using the new and shiny platform that came out yesterday. 50% lower rate of platform-induced bitrot for the project as a whole. C'mon, who wouldn't want the world to work like that?