3 ms·
In this context, strong as compared to Ruby/Python/Javascript
by supster 11y ago
In this context, strong as compared to Ruby/Python/Javascript
- whitegrape 11y agoSeems odd to lump Python (which is pretty strongly typed) with Ruby and JavaScript (JS especially not being strong). Edit: Actually this whole thread makes it seem like we all have our own different definitions on what makes something "strongly typed" (or just confusion with strong and static). For myself, a language's type system's relative strength is all about how it handles (or doesn't handle) implicit type conversions.
- supster 11y agoI lump them since they are the traditional "dynamic scripting" languages popular in backend development. But I agree the strong/weak designations are actually not so neatly segmented.
- halosghost 11y agoThis is roughly my point. “Strong” and “Weak” are inherently relative terms; so, when used without a reference point, they will mean something different to different people. So, without a point of reference, the terms are not useful.
- whitegrape 11y agoEven being inherently relative, you still need to determine the underlying values with some metric (like implicit type conversions, or max deadlift). If you tell me someone's max deadlift is twice their bodyweight, that tells me they're strong, even if it doesn't tell me their relative strength compared to say Sigmarsson. If someone says "Language X generally forces you to be explicit with your type conversions" that tells me it's strongly typed. Is it more strongly typed than language Y? That depends on explicitness exceptions -- e.g. Java does implicit autoboxing and toString()ing when you're doing string concatenation, Go effectively type aliases primitives so that e.g. net.IP can implicitly convert to []byte, Python complains when you don't explicitly call str() on things but converts numbers pretty freely (like auto-converting to a bignum, whereas other languages might throw an exception or automatically and silently wrap-around to a much smaller number than expected).
- catnaroek 11y ago“Strong typing” doesn't mean anything when comparing languages. The difference between raising a `TypeError` at runtime or silently doing something wrong is entirely a matter of standard library design. For example, you can replace Python's built-in lists with your own list class that is as “weakly typed” as you want. But, from the point of view of programming languages, the only thing that matters is that an unwanted situation couldn't be ruled out by the language itself.
- halosghost 11y agoSo, is your contention that both Go and Swift have equally-strong type systems? If so, you may want to consider saying that instead (though I am not sure how to phrase that in the format you have). If not, should they not be bolded with some elaboration on which is stronger or weaker and why? Or, were you not interested in a discussion of type-systems (if so, perhaps you should just remove the “strong” from that first line :P)?
- supster 11y agoPoint well made, I've changed the post to reflect this :)