Hacker News new | past | comments | ask | show | jobs | submit login

Actually Ruby and Java are both large languages compared to JS. Ruby especially - compare its object system with Javascript's, or consider it has 3 flavours of lambda ;)

Nice to take 2 quotes out of context of their explanations.

And finally, I've written a heap of Ruby, Python & AS3 and enough Clojure, Haskell and Go to be able to say: Javascript is a great little language. We use it because of history, sure, but learn how to use it before bashing it.

p.s http://www.paulgraham.com/disagree.html




Are you the author?

The whole article just seems to be missing the point entirely.

It pretty much answers everything with "oh but you can write a hack to work around that" or "oh there is some library you can use that plugs that gap". Whilst yes, these may be viable "solutions" for hacking something out. It doesn't refute the claim by the original article that JS is a bad language. It actually just reinforces it with yet more examples.

The only positives to take away from the article are where it highlights features coming in ES6 to actually solve some of the problems. But these admissions seem to contradict the premise of the article.


Yes.

No I'm not missing the point: I show how, within a few lines, these 'missing features' disappear. e.g: constants, type annotations, objects as keys.

Adding a whole language feature to save a few lines of code - not to my taste. You don't need a new language feature to express an idea if it can be trivially expressed in the language as it stands.


I didn't like the constants solution for nulls. Why not use a Maybe monad? I'm surprised that you didn't considering your claimed language experience.

I guess I just don't agree with your fundamental position on this. That writing yet more code to workaround a bad language is in anyway a long-term solution. At some point you'll want to bring more devs onto your team and then you'll need to explain all this technical debt and hacks to them. Not good.

I still believe you're missing the point of the original article you were refuting. It's not about being able to workaround something. It's about not needing to workaround flaws in the language in the first place. That's what defines a good language.

Further reading for you (unordered):

1. http://www.codinghorror.com/blog/2007/05/the-best-code-is-no...

2. "The line of code you don’t write is the line of code you never have to debug." -- Steve Jobs

3. Mythical Man Month (a book)


Maybe monad - like this one I wrote? http://truffles.me.uk/playing-with-es6-generators-to-make-a-.... FYI - I'm sure you're not trying to be, but you're coming off as terribly condescending...

Yes: we disagree. I write 3 lines where others see a need for new language features.


I cannot comment on Ruby. I, personally, think Java is a much bigger language than (base without other scripts included) Javascript. Of the two, I prefer Java for it's strong types. My biggest problem with Javascript is that if I make a typo on a variable name, it can be very difficult to debug. This could perhaps be mitigated by using an IDE, I don't know since I don't use JS that often. I feel like this is not a major issue and work on LLVM+emscripten will let me work in almost whatever language I want and have it end up in Javascript in the near future.


Why do you think Java is bigger?

From my perspective, Java has, effectively, structs (well defined groups of data) and a few primitive types, and a class system which is dead simple. It's tiny, comparable to Lua imo.

It's more restrictive, sure, but the dynamic-ness of Javascript is a hindrance when it comes to language spec because the base language functions need to be able to interpret all the different primitive types. There's stacks and stacks of corner cases to remember while Java just says "Nope, wrong type".


Generics, interfaces, abstract classes, method visibility, statics, different flavours of numbers (and primitives), inner-classes, huge array of data-structures, iterators, checked exceptions, annotations, threads...

Comparable to Lua? :)


I'll give you generics. Statics, method visibility vs global/local/self. Interfaces, abstract classes, inner classes vs metatables. Data-structures apart from array are implemented on top of the language, array vs tables. Iterators are implemented on top of the language vs lua where they are part of the language. Checked exceptions can just be cast to Exception and ignored. Annotations are optional. Threads vs coroutines.

Yes, comparable to Lua. I'd probably not say it's smaller than Lua but I would say it's not greatly larger than it.


I think Java is bigger in terms of the amount of classes/methods that there are to remember. Perhaps I compare them unfairly because I consider everything in the SDK to be a part of Java, whereas the things people might usually bundle in JS (JQuery, etc) I don't consider part of JS because you have to go out and get them separately. I didn't mean bigger in the sense that you need to know more to be able to use it, I meant it in the sense that it is a larger API.


>I didn't mean bigger in the sense that you need to know more to be able to use it

Ah ok, well I can see why we have differing opinions because that's exactly what I mean :)

I mean base language including corner-cases, not any of the libraries (even if they're included in the SDK). I think they'd both be huge if we included libraries, since I'd lump in DOM manipulation and something like JQuery into Javascript if Java gets the SDK libraries.


But all of those things you listed are very different things. In JavaScript they are the same thing.


Please expand your response, I don't understand what you mean when you say they are "the same thing".


Just a couple of examples. Arrays and Objects are the same type of structure in JavaScript. Arrays just happen to be indexed by integers and Objects by strings. In Java this is not the case.

Another example, in Java Classes are not objects that can be manipulated, they require a special form (generics) for that. In JavaScript a "class" is just a function that has some default properties attached.


Just a couple of examples. Arrays and Objects are the same type of structure in JavaScript. Arrays just happen to be indexed by integers and Objects by strings.

This description doesn't tell the whole story, leading people to a false conclusion of simplicity.

When it comes to JavaScript arrays, a lot of magic is happening under the covers that doesn't happen with non-array objects. Good JavaScript developers need to know those details, and that counts as complexity.

You're doing people here a disservice by leaving out relevant information.


The associative arrays in JS are simpler than objects in Java but the expressiveness means you need to be aware of all the different types of type coercion and how it all interacts at runtime. I don't think this is that difficult but it's no more difficult to lay out your data before runtime. I think this is a wash that goes to the dynamic vs static debate which we all know can be argued about for days.

You're leaving out prototypes which I find much more complicated than Java Classes.


But the discussion isn't about complexity, the discussion is about "smallness" and prototypes are definitely small. They are just "bags of properties" like all JavaScript objects. They just have the special function of being automatically applied to a new object's "__proto__" property when using new. Compare that to Java, where Classes are not objects themselves, they are blueprints for creating objects. But the distinction there means if you want to reason about Classes you need a special form in generics.


Javascript suffers the curse of popularity in spades. Most of its users today do not use it as a language at all, but instead as very light mechanism for getting a web browser to do weird things. Using Javascript as a language isn't bad and I think that's worth talking about. Especially since putting more effort there may let Javascript take advantage of some of its popularity.

Javascript is definitely microscopic compared to Ruby or Java. Lua, Smalltalk, Scheme have it handily beat on size, though. Furthermore, Haskell is absolutely lightyears ahead of Javascript in semantic niceness, but it succeeds there by being a much larger language, so YMMV.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: