Live data from Hacker News

JSX - a faster, safer, easier alternative to JavaScript

jsx.github.com

61–70 of 73 posts

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

#62

Earlier quoted context omitted.

@olalonde that's a bit of a cop out, of course I've read that article. That is why I'm baffled by the assertion that prototypes are more primitive than classes. It doesn't add up with the definitions of what amounts to being high level and low level. If you have something more specific to say I suggest you say it, but it's pretty lame to just wave your hands at a wikipedia article and tell me to figure out something…

Prototypes are a primitive data type of Javascript (a basic building block). Classes are not offered natively and have to be constructed with lower level building blocks such as prototypes. This is why classes are said to be higher level than prototypes in Javascript. Does that help?

Do you think that is the sense of the word "Primitive" intended by the author of JSX? In that sense of the word, what does "More" primitive or "Too primitive" mean? I would have thought something was either a primitive or it wasn't- not a sliding scale.

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

#63

Earlier quoted context omitted.

Could you use the reply button when replying instead of using the @name notation? It's kind of hard to follow your responses.

I would have if I could have, but I didn't know the rules of when reply buttons appear.

Click on "link" for the message to reply if you don't want to wait.

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

#64
post #51

Earlier quoted context omitted.

Anything I can do with a string, I could also do with an array. However, it would take extra work to make an array behave like a string, in the form of helper functions, etc. If I really wanted to prove a point, I could make a string behave like an array. But that would take even more work because an array is a very flexible tool used for a variety of low level purposes. Therefor, according to your argument, a string…

You're kind of stretching the metaphor a bit far here. In the javascript language interpreters, prototypes are implemented with classes. In JSX classes are implemented with prototypes. In C, strings are implemented as arrays. In shell scripting, arrays are implemented with strings. All we get out of this is that whether a programming construct is low level or high level is relative to how it was implemented, and is n…

Something being "a primitive" is entirely based on implementation details. Not implementation details of how the language interpreters/compilers are constructed, but how you as a programmer implement things in the language in question.

A associative array might be considered a language primitive in PHP, but not in C. It is contextually dependent on the language being discussed.

Without speaking about a specific language, you cannot define something as a primitive or not in the strictly programming sense. Once you start talking about comparing two types of constructs in an abstract sense, the word primitive can only be interpreted using the English common usage, and then you are talking about an entirely different concept.

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

#65
post #51

Earlier quoted context omitted.

@viraptor and so we can see that we must take into account more than just whether one can be simulated on another, we must take into account /expressiveness/, or level of complexity as well! In theory, you could simulate prototypes with classes too. You have to be able to, or else it wouldn't be possible to write an interpreter for a language which supports prototypes. The question of "can" and "can't" then, in the c…

Anything I can do with a string, I could also do with an array. However, it would take extra work to make an array behave like a string, in the form of helper functions, etc. If I really wanted to prove a point, I could make a string behave like an array. But that would take even more work because an array is a very flexible tool used for a variety of low level purposes. Therefor, according to your argument, a string…

Re-reading this... It's clear what is "a primitive" in javascript. but what does "Too-Primitive" mean? The sense of the word "primitive" as in language primitive is a set, not a quantity. Something is either a primitive or it is not. there's no such thing as "too primitive"

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

#66
post #49

Earlier quoted context omitted.

I didn't notice there were no periods till I finished reading and then had a "hey, wait a second" glance back This is an experiment worth trying out: just write everything in this style for a while The main problem I see here is figuring out whether a new sentence has been started when a Proper Noun or capitalized pronoun like "I" has been introduced I provide the current sentence as an example of that It's not so ha…

"... been introduced I provide the ..." I'll admit that I did a triple-take when reading through your example. Let's keep periods. :)

This is a cognitive problem. I also read you as doing a "double-take", even though you clearly wrote "triple-take". Another cognition issue. The unthinking mind reacting automatically without consulting our conscious. The solution is obviously to augment our brains with computers. :)

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

#67
post #43

Earlier quoted context omitted.

I agree We should also take periods out of sentences They aren't needed as long as you capitalize the first letter of every sentence This makes things much cleaner

Odd, I had no problem reading your comment. It also has an unusual clean-ness. Maybe period-less sentences are the future Throughout history english has already had many typological changes From a DRY stand-point capitalization and periods contain the same information payload Eliminating one of them would thus be good software engineering Right?

Interesting. RandallBrown's was easy to read, but you're wasn't. I read "are the future throughout history" and cracked up :)

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

#68
post #35

Looks like ActionScript, which is already based off ECMAScript...why not just use that, or extend what's already there? Getting adoption for a brand new language is tough, plus there's already a ton of software/libraries/tools written in As3

ActionScript running directly in the browser could be interesting. It has some cruft (much of it shared with JS due to the ECMAScript heritage), and the ECMAScript lineage leads to some weird features (e.g., typically its class-based inheritance is used, but it does include prototype inheritance), but it's not a bad language.

http://www.jangaroo.net/home/

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

#69
post #60

Earlier quoted context omitted.

There was no question that he was asking me to answer. He just told me that I was confused and pointed me at an article. He didn't say what he thought I was confused about. There was no obvious conclusion he was attempting to lead me to. There was no new evidence he was presenting. It's probably an mistake to read offense into text. There is no way for you to know whether I was offended or not. In this case I was not…

Your arguments all tend to make sense when using the English common usage of the word primitive, because I believe that JS prototypes are possibly more advanced than Java classes. However, speaking solely about the language Javascript, I think it's also fairly clear that in Javascript a prototype is a language primitive that you would use to build a Java-like class construct. Therefore in this context, according to t…

As a side note, when a human communicates something there is an intent and an interpretation. If the two don't match up, do you defer to the intent, or the interpretation as the correct meaning?

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

#70
post #51

Earlier quoted context omitted.

Anything I can do with a string, I could also do with an array. However, it would take extra work to make an array behave like a string, in the form of helper functions, etc. If I really wanted to prove a point, I could make a string behave like an array. But that would take even more work because an array is a very flexible tool used for a variety of low level purposes. Therefor, according to your argument, a string…

Re-reading this... It's clear what is "a primitive" in javascript. but what does "Too-Primitive" mean? The sense of the word "primitive" as in language primitive is a set, not a quantity. Something is either a primitive or it is not. there's no such thing as "too primitive"

You're right, when talking about a primitive type in the programming sense, something either is primitive or it isn't.

I took this phrase to mean that the prototype construct is "one step down on the composite type hierarchy" from what is needed to emulate as a Java-style class.

Rather, its a good building block but the necessary boilerplate code makes it "too basic" for that purpose. Therefor this developer has created a type further up the composite type hierarchy (or further away from the primitives) to accomplish his goal.

I don't think he's trying to suggest any deficiency in the expressiveness or capability of the prototype construct (he's obviously quite familiar with it to create this language). This is simply a tool for people who aren't familiar with (or don't make use of) that aspect of Javascript to be productive by utilising a more brief, or possibly more familiar (ie Java) syntax.

Post reply on HN