You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, one can specify specific object types as so:
let f(o as { alpha: String, bravo: Number }) ->
Which can get unwieldy if the object is too complex or if there is practically any repetition in code.
Instead, I'm proposing the following syntax:
interface Thing = {
alpha: String
bravo: Number
}
let f(o as Thing) ->
In the previous example, Thing would not exist at runtime and merely be a compile-time alias like C's typedef. One would be able to alias any type with a name, including functions or other interfaces or basically anything that already works in the type system.
Also, having generic support would be nice:
interface Box<T> = {
get: -> T
set: T -> T
}
let f(o as Box<Number>) ->
let g(o as Box) -> // the T in Box<T> represents the "any" type here, since unspecified.
The text was updated successfully, but these errors were encountered:
Currently, one can specify specific object types as so:
Which can get unwieldy if the object is too complex or if there is practically any repetition in code.
Instead, I'm proposing the following syntax:
In the previous example,
Thing
would not exist at runtime and merely be a compile-time alias like C'stypedef
. One would be able to alias any type with a name, including functions or other interfaces or basically anything that already works in the type system.Also, having generic support would be nice:
The text was updated successfully, but these errors were encountered: