News for hackers. Stuff that matters.
Re:GNOME project picks JavaScript as "first class" dev language by tracker1 on Wednesday February 06, 2013 @01:01PM (#5177824)
Javascript when doing operations between to variables will try to coerce them into the strongest type that both support... in your example that is String, in this case ({}).toString() == "[object Object]" ... which is why you get the result. Your not understanding how a system works is not an error in the system.

What would you expect in your example? A deep copy/merge, a shallow copy/merge... right merged with left and result returned?

Re:GNOME project picks JavaScript as "first class" dev language by keeperofdakeys on Wednesday February 06, 2013 @08:29PM (#5179984)
While the results are definitely deterministic, and play by a set of rules, most people don't bother learning these rules. This can lead to bugs in programs, if people do not take proper care. Since weak-typing doesn't give me any features, and could be a source of bugs in my program, I prefer to use languages that don't use it.
Re:GNOME project picks JavaScript as "first class" dev language by correnos on Wednesday February 06, 2013 @10:08PM (#5180284)
It's not even an issue in languages (C) that don't strongly type for performance reasons, or because you get closer hardware access as a result (though these count as features themselves). The problem is that in Javascript, you don't get either of these -- there's no benefits, there are only new bug vectors. This wouldn't be as big of an issue if the default coercion behaviour was generally helpful, but it's not. It's just a pain.
Re:GNOME project picks JavaScript as "first class" dev language by correnos on Wednesday February 06, 2013 @07:28PM (#5179819)
> what would you expect?

I expect a type error, like I said before. Implicit coercion between types is the definition of weak typing, and is part of what separates Python from Javascript.