Live data from Hacker News

JSX - a faster, safer, easier alternative to JavaScript

jsx.github.com

11–20 of 73 posts

Re: JSX - a faster, safer, easier alternative to JavaScript

#11
post #3

the jsx source code of the "hello world" example is only 62.5% of the code needed by dart for the same example. 5 lines vs 8 lines of code. the compiled JS source of the "hello world" example is only 0.5% of the code needed for the same task by dart. 91 lines vs 17259 lines code.

Those are pretty unimportant metrics. Especially given that Dart's eventual intended usage is not to be compiled to JS and the infamous example you cite is strikingly unfair . The real world is much, much, much, much less code.

Besides taking something like "5 lines vs 8 lines for a hello world" and acting as if ALL code bases are automatically that much more bloated via a percentage like that is silly at worst, disingenuous at best.

Re: JSX - a faster, safer, easier alternative to JavaScript

#13
post #3

the jsx source code of the "hello world" example is only 62.5% of the code needed by dart for the same example. 5 lines vs 8 lines of code. the compiled JS source of the "hello world" example is only 0.5% of the code needed for the same task by dart. 91 lines vs 17259 lines code.

The equivalent in Dart is:

  main() {
    print("hello world!");
  }
and you know the "17259 lines" thing is FUD.

EDIT: The above Dart code currently generates 445 lines of JS with comments and readable formatting. Obviously it's not quite where it needs to be but it's coming along quite well.

Re: JSX - a faster, safer, easier alternative to JavaScript

#14

"JSX offers a solid class system much like the Java programming language, freeing the developers from working with the too-primitive prototype-based inheritance system provided by JavaScript." Pass.

That's a weird thing to think. If you can simulate classes with prototypes, but you can't simulate prototypes with classes, what is the natural conclusion you can come to about which is more expressive or primitive?

It would seem as though prototypes are the more expressive option if you can use them to simulate classes. In fact, one could argue that this is essentially what Python does.

...but the OP seemed to indicate that prototypes were "primitive", and it sounds like you agree with him. Are you trying to say something that I'm missing?

Re: JSX - a faster, safer, easier alternative to JavaScript

#15
post #6

function foo(bar : string) : string... Why, why do we need unnecessary tokens?! Get rid of the stupid :'s.

I think they make the types read better, personally, especially if you leave out the space to the left-hand side of the ':'. It clearly signifies to the reader where the code is entering the type grammar. And if you leave out both the spaces to the left and the right of the ':' (as OCaml code often does), it's exactly as many characters as the version with spaces.

Re: JSX - a faster, safer, easier alternative to JavaScript

#17

"JSX offers a solid class system much like the Java programming language, freeing the developers from working with the too-primitive prototype-based inheritance system provided by JavaScript." Pass.

That's a weird thing to think. If you can simulate classes with prototypes, but you can't simulate prototypes with classes, what is the natural conclusion you can come to about which is more expressive or primitive?

@j_baker I do not agree that prototypes are primitive and I decided to express this in the form of socratic irony.

@fleitz Whether prototypes are overly complex is neither here nor there. the question is whether they are primitive. More primitive than classes- something which is historically and demonstrably untrue, in my opinion.

Re: JSX - a faster, safer, easier alternative to JavaScript

#18

"JSX offers a solid class system much like the Java programming language, freeing the developers from working with the too-primitive prototype-based inheritance system provided by JavaScript." Pass.

That's a weird thing to think. If you can simulate classes with prototypes, but you can't simulate prototypes with classes, what is the natural conclusion you can come to about which is more expressive or primitive?

When talking about programming languages, "primitive" usually means low level. For example, primitive data types (http://en.wikipedia.org/wiki/Primitive_data_type).

Re: JSX - a faster, safer, easier alternative to JavaScript

#19
post #10

Earlier quoted context omitted.

That's a weird thing to think. If you can simulate classes with prototypes, but you can't simulate prototypes with classes, what is the natural conclusion you can come to about which is more expressive or primitive?

That prototypes are overly complex. You can't simulate most imperative programs with functional ones because writing in a functional language eliminates a vast majority of bugs due to incomplete reasoning about memory barriers and other really hard to duplicate issues like race conditions. CHESS is an amazing piece of software precisely because it CAN simulate race conditions and reproduce them, however, if these thi…

I'm not saying you're wrong, but isn't this a bit like saying that files are overly complex because they can be used to simulate sockets?

Re: JSX - a faster, safer, easier alternative to JavaScript

#20
post #14

Earlier quoted context omitted.

That's a weird thing to think. If you can simulate classes with prototypes, but you can't simulate prototypes with classes, what is the natural conclusion you can come to about which is more expressive or primitive?

It would seem as though prototypes are the more expressive option if you can use them to simulate classes. In fact, one could argue that this is essentially what Python does. ...but the OP seemed to indicate that prototypes were "primitive", and it sounds like you agree with him. Are you trying to say something that I'm missing?

That's not what expressiveness means. Classes can be simulated in assembly but assembly isn't very expressive.
Post reply on HN