erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.61k stars 53 forks source link

Change polymorphic type enclosures from parentheses to square brackets #483

Open mtshiba opened 5 months ago

mtshiba commented 5 months ago

The current Erg polymorphic type is denoted as K(T), but K[T] is more reasonable. First, polymorphic types are not functions; Class is a true type-level function that takes a type and returns a class, while Array, for example, is not. Second, it is incompatible with Python's syntax: Python's syntax for polymorphic types is K[T], and K(T) covers the syntax for creating an instance of class K.