ricardoboss / STEP

The STEP programming language
http://step-lang.dev/
MIT License
5 stars 1 forks source link

Generic parameters (`list<T>`, `map<K, V>` and `function<R>`) #100

Closed ricardoboss closed 11 months ago

ricardoboss commented 1 year ago

The initial idea of this language was to introduce newcomers to the concepts of programming.

One such concept is that of variables and that they have a certain type. For that reason, I decided to only declare variables using the <typename> <identifier> = <value> form.

The types list and map got introduced pretty willy-nilly. Most languages also have the concept of generic parameters, that constrain which types can be contained in others. So for lists, this would explicitly constraint the types of values contained in it. Same goes for maps. With functions, generic parameters can be used to declare the return type and enable the interpreter to check the variable type before running the function. This would also remove the ability to return different types from a single function (at least until union types are supported).

ricardoboss commented 11 months ago

I will revisit this in the future. For now, I'll take this off the roadmap