News for hackers. Stuff that matters.
Re:Python Is Eating the World by enginaar on Monday August 12, 2019 @04:12PM (#20679439)
Could you elaborate or point to a resource? AFAIK, term "strongly typed" is usually used to refer to that the type cannot change but I'm failing to find a well defined definition or the comparison against statically typed.
Re:Python Is Eating the World by kbp on Monday August 12, 2019 @05:41PM (#20680340)
Static typing means that types are figured out statically by looking at the source code, and type errors are detected then when it notices a mismatch. Dynamic typing means that types are worked out at runtime by looking at live objects when code operating on them executes.

Strong typing means that types cannot be substituted for other types. In C, you can write `int x = "one"` and the char * (address of) "one" is automatically converted to an int, or in Javascript you can write 1 + "2" and a string "1" is automatically created; depending who you're talking to, either or both of these qualify as weak typing.

They're both spectrums, and commonly confused with each other.

Re:Python Is Eating the World by enginaar on Tuesday August 13, 2019 @11:48AM (#20686946)
You're explaining static typing vs dynamic typing. I'm still failing to see how different Strong vs Static. If the only difference is "Static" means "types are figured out statically by looking at the source code" do you mean it's possible to change the type unlike strong typing? If not, can we say Static encapsulates Strong?
Re:Python Is Eating the World by kbp on Saturday August 17, 2019 @04:26PM (#20726126)
Static typing is not a superset of strong typing, they're on different axes. Strong vs weak typing (which I explained in the second paragraph) is about how strictly types need to match expected types before you get a type error. Static vs dynamic typing is about when you get a type error (during a static typechecking phase, or at runtime when you try to use a value as that type).

When you say the type cannot change, that's ambiguous: do you mean the type of the value a variable holds, or the type of the value itself? In C (a statically typed language), "int x" means that x will always hold an int, but you can still assign a pointer to it, it just turns into an int (weak typing). In Python (a dynamically typed language), the variable "x" wouldn't have a type (so it could hold an int at one point and a string later), but the value it holds does, and because it's strongly typed, it would throw a type error if you attempted to use it in a place where it wanted a different type (eg, `1 + "2"` does not turn 1 into a string or "2" into an int).

Re:Python Is Eating the World by enginaar on Monday August 19, 2019 @03:55PM (#20741212)
If I got this correct, you're saying strong can be compared to weak and static can be compared to dynamic. So there is no such thing as strong vs static typing comparison.
Re:Python Is Eating the World by kbp on Monday August 19, 2019 @05:49PM (#20742144)
Right, they describe different aspects of how types work in a language.
Re:Python Is Eating the World by enginaar on Thursday August 22, 2019 @04:19PM (#20771989)
Thanks. I appreciate the time you took for clarifying in detail.
Re:Python Is Eating the World by willtim on Monday August 12, 2019 @06:11PM (#20680598)
"Dynamic typing" is really just case analysis at runtime. Every static language is capable of dynamic typing, it's not some feature that statically typed languages lack. A dynamic language is really just a static language with one type.
Re:Python Is Eating the World by kbp on Monday August 12, 2019 @07:39PM (#20681321)
Why aren't statically typed programs really just dynamically typed programs where all the types happen to be statically inferable?
Re:Python Is Eating the World by willtim on Tuesday August 13, 2019 @01:39AM (#20683066)
Because most statically typed languages allow us to define our own types, add type signatures to constrain etc. Dependently typed languages also allow types to depend on values. Inference is useful, but only one aspect of static typing.
Re:Python Is Eating the World by willtim on Monday August 12, 2019 @05:25PM (#20680185)
The word "type" has a specific meaning in maths/logic, which is not the same as that used by the "dynamic" languages community.

Professor Bob Harper of CMU would refer to Python as unityped, i.e. having a single type: https://existentialtype.wordpress.com/2011/03/19/dynamic-lan...