3 ms·
> every dynamically-typed language has "weird" behaviour around type coercion Do they now? $ irb irb(main):001:0> "0" + 1 TypeError: no implicit c
by pdpi 8y ago
> every dynamically-typed language has "weird" behaviour around type coercion
Do they now?
$ irb
irb(main):001:0> "0" + 1
TypeError: no implicit conversion of Fixnum into String
from (irb):1:in `+'
from (irb):1
from /usr/bin/irb:11:in `<main>'
irb(main):002:0> ^D
$ python
>>> "0" + 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot concatenate 'str' and 'int' objects
>>> ^D
$ node
> "0" + 1
'01'
> Meanwhile, those of us using JavaScript simply run one process per core and never worry about contention, deadlocks, or race conditions.
If you never worry about those things, then you're either not sharing any resources at all (in which case threads are also dead easy), or you're failing to deal with the shared resources properly.
- StavrosK 8y agoI know you know this, but for the GP or anyone else: "Dynamically typed" doesn't mean "strongly typed". Python and Ruby are strongly typed, JS is weakly typed.
- workinthehead 8y agoIn your rush to be an asshole you completely missed my point, smart guy.
- pdpi 8y agoYeah, went for the "picture is worth a thousand words" approach to explaining the distinction :)
- workinthehead 8y agoand yet you still managed to misunderstand the point :)
- workinthehead 8y agoThank you for illustrating my point. All of the dynamic languages made different decisions on how to handle type conflicts, there simply is no right or wrong answer. Oh, and JavaScript is single-threaded. It's impossible to share resources in a single process.
- pdpi 8y ago> Oh, and JavaScript is single-threaded. It's impossible to share resources in a single process. DBs, files, etc etc. in-process memory isn't the only resource you're sharing.
- workinthehead 8y agoYou really don't have a solid understanding of how computers work, do you?