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

Wait, the type checking isn't static?


sort by: page size:

How does that work? I thought static typing was only checked when compiling.

Oof, that’s quite a take. Static type checkers by definition don’t change the language’s functionality; they merely check the types.

What's status of static typing checking ?

Oh ok. So it's not really static at all, they're just calling it that because it sounds better. It's simply dynamic type-checking that checks the types immediately prior to calling the function instead of checking them at the top of the function body. Offhand, it seems that the only benefit to this approach (checking prior to calling the function instead of checking inside the function) is the ability to cache the results and skip checking the same callsite in the future if nothing's changed.

Being able to significantly optimize type-checking for scripting languages like this to the point where you can actually run this in production seems quite valuable. But calling it "static type-checking" is simply wrong. Granted, they're calling it "just-in-time static", but that phrase is contradictory, it would be like saying "dynamic static type checking".


But it also has a statically checked type system.

Not for nothing, but static type checking isn't some kind of fad. It's been the rule, not the exception, since the 1980s at least.

Actual static typing and forced type checking.

Some people really like static type checking.

Type checking as an add-on is okay but it is not the same thing as a statically typed language.

Right, but I'm curious to know among statically typed languages, which ones have more checks than others.

Ah yes, good catch. I meant "statically-typed".

Your view of what static type checking is or isn't seems to be limited to your understanding of types (and what can be expressed with them) in Python. There's a world of languages outside Python, even for languages with dynamic typing!

plus static type checking

Yeah, I think this is something where static typechecking helps a lot.

I just read the first part of your comment as "no true programmer would need no filthy static type checking". Sorry if I misunderstood.

I find it hard to correlate use of static typing with development experience, that's all.


TONS of languages don't have written type annotations all over the place and still have static type checking.

It's not just static typing. It's strong static typing like you see in Haskell, Idris, Scala, F#, etc.

if you really care about static type checking, you probably wouldn't be using C

I've grown to hate the phrase "static typing". It's almost as meaningless as "strong typing". While checking types compile-time certainly has it's benefits, the issue presented here is almost entirely orthogonal to that. The problem here is that strings are handled essentially as untyped opaque blobs as far as the type system is concerned. If the strings were typed properly, then both static and dynamic type systems (if otherwise equivalent) would catch the errors.
next

Legal | privacy