Open holgerl opened 6 years ago
Alternatively, values can be used directly to express types:
(Here I am using name
instead of var
)
@ name myFunction type (0 , 0) :
@ name foo type number = 3
@ . myValue + (@ . argument)
@ name MyService :=
@ name myAction type (0 , "") :
@ var foo = 40
@ . foo + (@ . argument) as string
@ name myStr type "" = "Hello"
@ name isItSo type true = false
@ name myStuff type (@ . MyService) = (@ . MyService)
Since type true
is a little awkward. There could be some built in variables like this:
@ name Boolean = true
@ name Text = ""
@ name Number = 0
Then they are used like this:
@ name myStr type Text = "Hello"
@ name isItSo type Boolean = false
@ name foo type Number = 123
The number service already has an action as
that takes string
as as argument. This is really a kind of type, so it should be changed t use values as types:
42 as Number
A type system would enable better error messages and a range of other benefits.
It could be done within the current syntax: