News for hackers. Stuff that matters.
Re:Strong typing, a hill I'm willing to die on by 1-more on Wednesday October 04, 2023 @10:42AM (#37765896)
What does "strong" mean as regards typing. I've heard a few different definitions so I'm curious what yours is in the context of this article.
Re:Strong typing, a hill I'm willing to die on by bigstrat2003 on Wednesday October 04, 2023 @10:59AM (#37766148)
As far as I'm aware, the generally accepted definition of strong typing is: some object in memory has a type, and the compiler (or interpreter) will not let you treat it as another type without some kind of explicit instruction to do so. This is in contrast to weak typing, where the compiler/interpreter will happily try to treat a Bar object as a Foo object if you do some Foo operation on it.
Re:Strong typing, a hill I'm willing to die on by gpderetta on Wednesday October 04, 2023 @12:21PM (#37767430)
That's the definition of type-safety (or memory safety that is pretty much equivalent). "strong typing" has no generally accepted definition.
Re:Strong typing, a hill I'm willing to die on by bigstrat2003 on Wednesday October 04, 2023 @06:51PM (#37772828)
Memory safety is definitely not equivalent. Memory safety is more like not going past the end of an array, not doing use after free, etc. I agree that what I said is pretty much also the definition of type safety. But in my experience it is also the generally accepted definition of strong typing.
Re:Strong typing, a hill I'm willing to die on by 1-more on Wednesday October 04, 2023 @04:21PM (#37771142)
That seems to be a subset of static typing. Is there an example of this that does not involve non-static typing?
Re:Strong typing, a hill I'm willing to die on by bigstrat2003 on Wednesday October 04, 2023 @08:03PM (#37773343)
I think you mean "involves non-static typing"? If so, Python. You can't (for example) do something like '1 + "2"', because those types aren't compatible. It's dynamically, but strongly, typed.