3 ms·
am a fan of strongly-typed languages Nit-pick: suspect you are actually a fan of statically-typed languages. Python is a strongly-typed language, but not stati
by ubernostrum 13y ago
am a fan of strongly-typed languages
Nit-pick: suspect you are actually a fan of statically-typed languages. Python is a strongly-typed language, but not statically-typed.
(general easy way to tell them apart: in a statically-typed language, both the name and the value bound to it have a type, and those types must match; in a dynamically-typed language only the value has a type; in a weakly-typed language, operations on incompatible types are permitted, and they may be coerced for compatibility; in a strongly-typed language, operations on incompatible types are an error -- usually at compile-time or equivalent for statically-typed, usually run-time for dynamically-typed)
- masklinn 13y ago> Nit-pick: suspect you are actually a fan of statically-typed languages. And probably closer to "statically-but-not-too-statically-typed-because-really-more-than-my-language-of-choice-is-too-much" languages. Self-avowed fans of "statically-typed languages" (usually java or C#) rarely consider giving up nulls and casts.
- meowface 13y agoIn some cases, Java is more weakly typed than Python or Ruby. Java: System.out.println("abc" + 5); -> "abc5" Python: print "abc" + 5 -> TypeError: cannot concatenate 'str' and 'int' objects Ruby: puts "abc" + 5 -> TypeError: can't convert Fixnum into String
- masklinn 13y agoAnd here we can see the issues and clusterfucks of the completely undefined and arbitrary "concept" of "weak" (conv. strong) typing: java's behavior here is well-defined, simple and statically typed, there's no more type loss than when doing `5 + 1.0` in Ruby or Python. Why do you find implicitly converting an int (/Fixnum) to a float (/Float) more palatable, when they have completely different internal representations, domains of definition, precisions, operational semantics and potential pitfalls? And what about Python's `"foo" * 3`? Hell, what about this: > class Fixnum > def to_str > self.to_s > end > end => nil > "5" + 3 => "53" so "strongly typed" it has a protocol for implicit string conversion. But wait, there's more without even bothering with overrides: > a = [1, 2, 3] => [1, 2, 3] > a[1.4] => 2 floating-point index to an array? no problem.