-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Milestone
Description
Similar to what typescript already offers (docs), it would be useful to have a way of naming new types.
Imagine the following use-case:
function sum(a, b)If we want to give it types but make it generic enough for all value types, a type alias would be great here1:
typealias Number = Integer or LongInteger or Float or Double
function sum(a as Number, b as Number) as NumberWithout type aliasing, we'll have to do this, which is somewhat verbose:
function sum(a as Integer or LongInteger or Float or Double, b as Integer or LongInteger or Float or Double) as Integer or LongInteger or Float or DoubleA question also remains: should the definition be restricted in scope to the file/namespace like typecast and alias, or should it be project-wide like const and interface? The latter makes more sense to me.
Footnotes
Metadata
Metadata
Assignees
Labels
No labels