Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

I'm well aware which languages are statically typed and which are not. I was answering your question:

> Have I misunderstood what is meant by strong type checker?



sort by: page size:

Fair point, thanks for calling it out. I should have said "statically checked, strongly typed languages"

Why "strong static typing" in particular? Surely there are many other things that could help.

"Strongly typed" != "Statically typed"

You mean statically, not strongly typed. Strong typing roughly means avoiding implicit type coercion.

Just for the records: strong != static typing && Runtime contracts != compile.time type checking

Indeed, it is strongly typed but not statically typed. The only thing is, almost every language is strongly typed now, the only counterexample I know is C (and derivatives). Not that there aren't others, but I'm not sure there are others that anyone really uses. So I wonder if it is really even worth saying a language is "strongly typed" anymore, it's hardly ever a distinction. Might as well just say "not C".

also strong typing and static typing are two different things

Sorry, you're right, it's strongly typed but it is not statically typed.

It sounds to me like you're coming at the question without understanding all the facts either. Strong static typing doesn't mean you need to specify all your types. That's an orthogonal issue. There was actually a variant of Smalltalk, called Strongtalk, which turned it into a statically typed language but allowed existing Smalltalk programs to run unaltered.

"Strong typing" most of the time means "no implicit type conversion" like e.g. C or Javascript do. That is indepentend of having statíc or dynamic typing (and anything between).

Static+strong typing is a nice combination, which is probably what hacker_9 meant to say.

ML family is particularly nice -- with Hindley-Milner type inference, you get a lot of static guarantees with none of the verbosity of languages like Java.


You may be confusing strongly and statically typed.

> e.g. Python (or even better, a strongly-typed language).

Python is strongly typed. Maybe you meant "statically"? (As opposed to dynamically.)


It has a strong type system. Are you mixing static and dynamic typing with weak and strong typing?

I believe Haskell would be considered have "strong static typing". Unfortunately, "strong" in this context is less precise than one might like: both Haskell and Java are generally considered "strongly typed", but Java allows e.g. type casting in a way that will not be statically type checked.

Haskell also uses type inference rather than requiring type declarations, but that is not _directly_ related.


> it's not a strongly typed language

Yes, it is. It's not a statically typed language. strong typing is not synonymous with static typing.


Static typing, not strong typing

So you really meant "static" and "dynamic", referring to type-checkers, which are completely independent of "strength" (which is commonly used to imply soundness).

Ironically, all dynamic type-checkers are more sound (by definition, they check all types at runtime) than most ancient static type-checkers that just do naive structural compile-time checks, allow casts, and mainly exist to specify size.


Types checked at compile time is called "static".

Strong has various meanings. Ada is "strong" versus C being "weak" though the basic Algol-like model is not so different, and if we don't count tagged types, neither language is dynamically typed in any way. (So if "strong" means "static", we would not be able to use the strong/weak terminology to contrast these languages!)

"Strong" in this context mean various things, ranging from C having holes in the type system that allow punning and bad memory references, to C having automatic conversions that are unsafe: for instance assigning a floating-point value to an integer location without an explicit conversion operator which handles situations when the conversion is impossible. Or not having a character type distinguished from an integer type.

C++ has more "strongly typed" enums than C; and what that means is that you can't assign an integer value to an enum object without a cast.

ANSI Lisp is fairly strong, but allows some relaxations: car on an empty list, integers usable where floating-point values expected (a bit like C) and such.

next

Legal | privacy