Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Making the "strong/weak" versus "static/dynamic" distinction is much more common in dynamic typing circles than static typing circles. And it makes total sense. Static typing people think of types as being syntactic. "Dynamic" typing seems like a misnomer--either the syntactic terms have strong types or they don't.


Common usage has definitely varied over the time I've used it. I remember one professor back in school even referring to C as strongly typed and Scheme as weakly typed.

I think some of the confusion is that the nature of the two sets of labels are commonly misunderstood. They're supposed to represent two orthogonal dichotomies about how languages design. In truth there is an orthogonal pair of dichotomies in there, but it's not captured by that set of labels. And the labels aren't really orthogonal.

The real dichotomies concern two different places where you can track type information: It can be associated with variables, or it can be associated with values. Some languages that represent the possibilities well are:

  - C: Variables, but not values
  - Ruby: Values, but not variables
  - C#: Both values and variables
  - FORTH: Neither variables nor values.
As for how they're commonly described: C is the classic example of static and weak, and C# is a good example of static and strong (though admittedly it has facilites for switching both off in a controlled manner). Ruby is dynamic and strong.

But nobody wants to call FORTH dynamic and weak, and for good reason: The very phrase "dynamically typed" implies that types are tracked, just dynamically. But FORTH doesn't track types at all; it's much more correct to describe it as untyped.

So that's where it breaks down: While strong vs. weak corresponds well to the question of whether types are associated with values, dynamic vs. static is not actually an orthogonal dichotomy, because the word dynamic describes a decision about both ways of tracking type: Dynamic languages associate type with values but not with variables. And my earlier description of Ruby as "dynamic and strong" is redundant.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: