top | item 36648769

(no title)

pmelendez | 2 years ago

> but Pascal’s type system was pretty solid

To be honest, this is a matter of styles, coming from a dynamic type background I don’t appreciate strongly typed systems as an advantage.

discuss

order

Jtsummers|2 years ago

Strongly typed is orthogonal to dynamic and static typing. Python and Common Lisp are both "strongly" typed and dynamically typed. There's no reason to shun strong typing if you also like dynamic typing.

pmelendez|2 years ago

I would be curious to see references that claims that dynamic and static typing are orthogonal with strongly typed systems, as “strongly type” is rather ambiguous and the only reason I used the term was because that was how Pascal was promoted back in the day (or at least how was taught to me)

From Wikipedia: In 1974, Liskov and S. Zilles defined a strongly-typed language as one in which "whenever an object is passed from a calling function to a called function, its type must be compatible with the type declared in the called function."

Note that the definition refers to type declaration, both being optional in Python and Common Lisp, so I wouldn’t use either as an example of strongly type languages.

slt2021|2 years ago

how can Python be strongly typed if it doesn't enforce types for declared arguments?

What is the value of this supposedly "strongly typed" Python's type system?

class Object:

    pass
def f(arg:int):

    print("type of arg = ", str(type(arg)))
f(1)

f(666.0)

f("kek")

f(Object())

type of arg = <class 'int'>

type of arg = <class 'float'>

type of arg = <class 'str'>

type of arg = <class '__main__.Object'>

and not a single error/warning thrown