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

> Python falls through because it doesn't have real lambda.

No it doesn't. Been using it for about 10 years can't remember being bothered by lacks of "real lambdas"

> There are minor details wrong with JavaScript. Normally you don't encounter them in daily use.

If there would be minor detail we wouldn't have had the "Good Parts" book. And trying to deals with variables in Javascript is pain, var vs no var, what does this do. Really strange weak typing rules.

Adding [] to {} should not produce some random value (what is it NaN or Object), it should throw an exception.

> Few other languages can match it's simplicity.

Wait, were you being sarcastic?




I assume you're referring to the "Wat" talk by Gary Bernhardt, here.

My question is why does it matter? It's funny and notable behavior, but why is this a problem that a real programmer will face dealing with a real problem?

(For reference, [] + [] = "", [] + {} = Object, {} + [] = 0, {} + {} = NaN)


It matters because it shows how incoherent is the Javascript type system, and how easy it is to get biten by it.

About Python lambdas, I miss them a lot. But one can not have everything...


Because it hides errors instead of helping the developer find them


Are JS developers often adding empty arrays and empty objects together? This seems more like a corner case than a real issue.

(Not snarky - I don't know JS)


As often as any programmers deliberately insert bugs in their code ;-)

Those values are usually in variables that and have been set maybe from a backend reply or from the UI at some point.

That is just one instance of the sloppy mess of weak typing. Instead of writing a long list of it I just used an example to illustrate.


No. You generally only add numbers and strings together.


Extreme nonsense behavior from the language you're using. People see that and think "that's just the tip of the iceberg".




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

Search: