News for hackers. Stuff that matters.
Re:More information on Google's new web language, Dash by cousin_it on Friday September 09, 2011 @10:19PM (#2980591)
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...

Re:More information on Google's new web language, Dash by haberman on Saturday September 10, 2011 @12:31PM (#2981831)
There 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.
Re:More information on Google's new web language, Dash by cousin_it on Sunday September 11, 2011 @02:31PM (#2984402)
> 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-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?

Re:More information on Google's new web language, Dash by josephg on Friday September 09, 2011 @11:00PM (#2980656)
It 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...

Re:More information on Google's new web language, Dash by cousin_it on Saturday September 10, 2011 @04:57AM (#2981203)
As 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.

Re:More information on Google's new web language, Dash by ehsanu1 on Saturday September 10, 2011 @06:28AM (#2981310)
As 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.

Re:More information on Google's new web language, Dash by quotemstr on Monday September 12, 2011 @04:10AM (#2986260)
> The jump from C++ to Java was big enough

You are aware that many people still write C++, yes?

Re:More information on Google's new web language, Dash by frou_dh on Saturday September 10, 2011 @01:36PM (#2981974)
Today's C# is much better than its original Java-clone status. I wouldn't brush it aside lightly.
Re:More information on Google's new web language, Dash by StrawberryFrog on Saturday September 10, 2011 @12:42PM (#2981858)
The article is specifically about generics in Java. I don't know Java generics, just the c# ones, so it's hard for me to say if the author is right about generics in java only or just wrong in general. Either way, a pointless article for this discussion.
Re:More information on Google's new web language, Dash by gnaritas on Saturday September 10, 2011 @02:31AM (#2981013)
You 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.

Re:More information on Google's new web language, Dash by cousin_it on Saturday September 10, 2011 @04:33AM (#2981167)
I explicitly talked about minor syntactic differences between curly-brace languages, not about Lisp or Smaltalk. Switching from one curly-brace language to another generally doesn't involve any deep paradigm shift, it's essentially just memorizing a bunch of irrelevant syntax differences. If I have some procedural C style functionality implemented the same way in languages X and Y (happens pretty often), having the code 95% identical is missing out on the nice things that I could have if the code were 100% identical.

It's true that the Java runtime and the C# runtime provide different services. But the same is true for databases. Oracle's feature set is different from PostgreSQL's. Yet the database community got its act together enough to standardize the syntax for basic features at least, so you don't have to relearn inner joins when you switch, and you can mention "SQL" in job openings and be understood. (I wonder if the NoSQL community ever gets smart enough to do the same?)

Re:More information on Google's new web language, Dash by mibbit on Saturday September 10, 2011 @03:03AM (#2981055)
BS. 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.

Re:More information on Google's new web language, Dash by gnaritas on Saturday September 10, 2011 @06:28PM (#2982662)
> It's a solved problem.

No it isn't.

> You don't see people endlessly coming up with new syntax for math do you.

Actually, yes, yes you do.

Re:More information on Google's new web language, Dash by ajanuary on Saturday September 10, 2011 @04:12AM (#2981135)
There are many mathematical notations for the same things, usually depending on the domain or different focus. Just like with programming languages.
Re:More information on Google's new web language, Dash by drothlis on Saturday September 10, 2011 @06:06AM (#2981282)
Choice 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.
Re:More information on Google's new web language, Dash by mibbit on Saturday September 10, 2011 @12:10PM (#2981786)
Imagine a world where instead of writing books, authors spent forever needlessly inventing new languages to write them in.
Re:More information on Google's new web language, Dash by gnaritas on Saturday September 10, 2011 @06:29PM (#2982667)
They already do both; have you not ever read Lord of the Rings?
Re:More information on Google's new web language, Dash by asynchrony on Saturday September 10, 2011 @04:43AM (#2981182)
There 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.
Re:More information on Google's new web language, Dash by nopassrecover on Saturday September 10, 2011 @06:07AM (#2981285)
FYI (based on comments in this thread made by you and others), C# is nothing like Java, despite similar C-derived syntax.
Re:More information on Google's new web language, Dash by ricardobeat on Friday September 09, 2011 @10:57PM (#2980650)
... Flash player?