StardustPL / Stardust

"A programming language that doesn't make me angry to use it."
https://StardustPL.GitHub.IO/
The Unlicense
4 stars 0 forks source link

Planning: Type System #3

Open LB-- opened 9 years ago

LB-- commented 9 years ago

The type system will be strongly typed and use a combination of static (compile time) and dynamic (run time) typing. Everything must have a type that, once chosen, cannot be changed, however the chosen type can be dynamically decided. For example, a function can accept a type as a parameter and then create a local variable of that type.

There will be a type type. There needs to be some way to indicate Which types are allowed for e.g. type parameters as obviously allowing all types would result in not being able to do anything with the type until it is examined. If a type parameter is limited to an interface then any type which implements the interface may be provided, and the code using the type parameter will only know the interface.

LB-- commented 8 years ago

I want to allow saying "any type which extends this type" for polymorphic types, but I also want to allow duck-typing. Simply having a function which returns true or false for whether a given type satisfies all requirements doesn't give enough info for the code using the type to do anything with it. Maybe something along the lines of C++ concepts...?

LB-- commented 6 years ago

https://www.youtube.com/watch?v=SWHvNvY-PHw