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
A type system would enable better error messages and a range of other benefits.
It could be done within the current syntax:
@ varfootypenumber=42
@ varbartypenumber=(2.5+40.3)
@ varvaluetypestring="lorem ipsum"// perhaps call the type "text"?
@ varisDonetypeboolean=true// perhaps call the type "truth"?// type of list is defined as the type of the last evaluated value, so that it might be a list of code to be evaluated
@ varmyListtypenumber=123
@ varbaztypeMyService=(@.MyService)// Not currently possible in hilvl to store services in variables?// Comparing types:
@ typeofbaz==MyService// Types of arguments and return values:
@ varMyService :=// The type when not specifying any type is the value itself, so the type is MyService
@ varmyActiontypestring : // function from number to string
@ varmyVariabletypenumber=(42+(@ .argumenttypenumber))// Argument usage is statically checked for type
@.myVariableasstring// The return value is statically checked for type
@ varmyValuetypestring=(MyServicemyAction1)// Types when doing higher order programming:
@ varMyService :=
@ varmyActiontypenumber :
@ setfoo=42// Variable in inner scope
@ varmyFunction : (@.argumenttypenumber)// argument is a list of code with last value number
@ myFunction// Invoking the argument as an action
@ varbar=MyServicemyAction
@ setfoo=50
@.foo+2// Alternative syntax?
@ typenumbernamefoo=42
The text was updated successfully, but these errors were encountered:
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:
A type system would enable better error messages and a range of other benefits.
It could be done within the current syntax:
The text was updated successfully, but these errors were encountered: