Basic Type System Terminology

3 points by ugur


fanf

There are at least 5 meanings of strongly/weakly typed in common use https://lobste.rs/c/hisnyn

It’s wrong to fixate on one meaning as the “right” one because that leads to misunderstandings. If anyone uses the terms strong or weak typing and you care about exactly what point they are making, you need to get them to clarify what they mean using more specific terminology.

LesleyLai

Note that dynamically typed is wholly distinct from un-typed, which is a term used to describe the complete absence of type checking, either statically or dynamically.

Referring to "dynamically typing" as "untyped" was pretty common, especially in old literature. The word comes from untyped lambda calculus, and probably predates "dynamic typing".

Below is a quote from "Types and Programming Languages":

The word "static" is sometimes added explicitly--we speak of a "statically typed programming language," for example--to distinguish the sorts of compile-time analyses we are considering here from the dynamic or latent typing found in languages such as Scheme [...], where tun-time type tags are used to distinguish different kings of structures in the heap. Terms like "dynamically typed" are arguably misnomers and should probably be replaced by "dynamically checked," but the usage is standard.

strongly-typed

I upgraded the switches in my keyboard for the gainz. Now I can type code strongly while strongly typing my code.

tel

The distinction I like is whether you apply types to variables or values. Variables, names in scopes, exist without running the code. If your type system considers their type it's probably static. If it only ascribes types to values then it's probably dynamic. Sometimes types of runtime values are called "tags" to distinguish.

rs86

That definition is too coarse to relate to day to day type system implementation and research… it’s more useful to first understand the difference between static analysis, that is, drawing conclusions without running the code, and dynamic analysis, done in runtime. Then there’s the whole thing of type systems, which admit static or dynamic aspects. And strong and weak typing are also subtle. “Weak” systems sometimes are characterized so by admiring type casts that are unsafe. But then again not all type systems will eliminate all runtime errors, so the strength is also not dichotomous.

It’s more useful to see: what does the analysis guarantees, when does it run, how does it run, and whether it is part of a type system, and what kinds of behavior it will let pass.