News for hackers. Stuff that matters.
Re:Use Your Type System by kitten_mittens_ on Thursday July 24, 2025 @11:43AM (#44672092)
There seem to be two competing nomenclatures around strong/weak typing where people mean static/dynamic instead.
Re:Use Your Type System by josephg on Thursday July 24, 2025 @11:53AM (#44672220)
Some people mistakenly call dynamic typing "weak typing" because they don't know what those words mean. PSA:

Static typing / dynamic typing refers to whether types are checked at compile time or runtime. "Static" = compile time (eg C, C++, Rust). "Dynamic" = runtime (eg Javascript, Ruby, Excel)

Strong / weak typing refers to how "wibbly wobbly" the type system is. x86 assembly language is "weakly typed" because registers don't have types. You can do (more or less) any operation with the value in any register. Like, you can treat a register value as a float in one instruction and then as a pointer during the next instruction.

Ruby is strongly typed because all values in the system have types. Types affects what you can do. If you treat a number like its an array in ruby, you get an error. (But the error happens at runtime because ruby is dynamically typed - thus typechecking only happens at runtime!).

Re:Use Your Type System by 0x457 on Thursday July 24, 2025 @04:26PM (#44675647)
It's strongly typed, but it's also duck typed. Also, in ruby everything is an object, even the class itself, so type checking there is weird.

Sure it stops you from running into "'1' + 2" issues, but won't stop you from yeeting VeryRawUnvalidatedResponseThatMightNotBeAuthorized to a function that takes TotalValidatedRequestCanUseDownstream. You won't even notice an issue until:

- you manually validate

- you call a method that is unavailable on the wrong object.

Re:Use Your Type System by arrowsmith on Friday July 25, 2025 @01:14PM (#44685577)
You just described why I fell out of love with Ruby.
Re:Use Your Type System by 0x457 on Monday July 28, 2025 @02:53PM (#44714025)
Because you wanted to do 1 + '1'?
Re:Use Your Type System by jnpnj on Thursday July 24, 2025 @01:37PM (#44673619)
yes, untyped names != untyped objects
Re:Use Your Type System by ameliaquining on Thursday July 24, 2025 @03:38PM (#44675086)
I recall a type theorist once defined the terms as follows (can't find the source): "A strongly typed language is one whose type system the speaker likes. A weakly typed language is one whose type system the speaker dislikes."

Related Stack Overflow post: https://stackoverflow.com/questions/2690544/what-is-the-diff...

So yeah I think we should just give up these terms as a bad job. If people mean "static" or "dynamic" then they can say that, those terms have basically agreed-upon meanings, and if they mean things like "the type system prohibits [specific runtime behavior]" or "the type system allows [specific kind of coercion]" then it's best to say those things explicitly with the details filled in.

Re:Use Your Type System by dpryden on Thursday July 24, 2025 @06:40PM (#44677180)
I think you might be thinking of https://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wr...

It says:

> I give the following general definitions for strong and weak typing, at least when used as absolutes:

> Strong typing: A type system that I like and feel comfortable with

> Weak typing: A type system that worries me, or makes me feel uncomfortable