3 ms·
> I'm pretty sure the last time I read that article it said that there is no generally accepted definition of weak typing. This discussion seems to echo that.
by nickknw 15y ago
> I'm pretty sure the last time I read that article it said that there is no generally accepted definition of weak typing. This discussion seems to echo that.
Agreed. There ARE definitions but they aren't terribly specific, useful, or even very consistent. Funnily enough, the wikipedia article on strong typing includes C and C++ as an example of strong typing.
In this case anyway, I think it's clear that the author was really talking about the static vs dynamic distinction, and should have used those terms instead:
> Some languages are strongly typed, which means that the programmer must define the type of every class, function, and variable that he uses; tiresome, but it can have big pay-offs in terms of overall speed. Other languages, like JavaScript, are weakly typed, which means that the programmer doesn’t have to worry about such piffling minutiae; you can just write some code and let the compiler do the heavy lifting.
- chc 15y agoFunnily enough, that definition (whether applied to static or strong typing) would exclude Haskell, one of the most strongly and statically typed languages known to man.
- nickknw 15y agoYeah it would, good catch. So to be more accurate, he was comparing explicit static typing with dynamic typing.
- DasIch 15y agoWhether or not a language is strongly typed has no effect on whether the programmer has to define the type of everything. You defined what a statically typed language is, not what a strongly typed language is. In fact if a language is strongly typed not defining anything will not necessarily have an impact on speed because it is possible to infer types statically at compile time like GHC does for Haskell.
- nickknw 15y agoI didn't attempt to define anything in my post, although I did quote from the article. In other words: I think we agree.