COMMUNITY

Strictly-typed vs statically-typed?

Why is Haxe described as strictly-typed, rather than statically-typed? Is there a difference?

I think this might answer your question

I understand that languages are characterized as either statically-typed (types checked at compile-time) or dynamically-typed. And Haxe certainly seems to be statically-typed.

And further, I get that some languages are more liberal with automatically converting types on-the-fly as needed, whereas others are more conservative in that regard.

But my particular question is regarding the “strictly-typed” designation. Maybe it’s just used as a synonym for strictly-typed, but perhaps it’s used because Haxe compiles to many targets — not just to native, or to some bytecode, which is often associated with statically-typed.

For me:

Statically typed is not being able to do:

var a = 3;
a = "foo";

Strict typing is everything’s type having to be declared or inferred at compile-time.

Statically typed is used in regard to runtime behavior. Strictly typed is used in regard to compile time behavior.

Haxe produces statically typed target code (even for dynamically typed targets) as types are set in stone at compile time.

1 Like