Collection: Language semantics #254
Replies: 3 comments 11 replies
Syntax for function declarations
A DATEX function can consist of keywords (pure / async / whatever), name, params, return type, and body. First of all the naive syntax could look like this: // default
function myFunction(x: integer) -> integer | string (
42
)// untyped and typed params
function myFunction(x, y: integer) -> integer | string (
42
)// mutable ref
function myFunction(&mut myRefMut) -> integer | string (
42
)// ref, variadic args
function myFunction(x: &MyRef, ...y: integer[]) -> &integer (
x
)// ref, variadic args and error
function myFunction(x: &MyRef, ...y: integer[]) -> Result<integer, Error> (
Ok 4
)Questions
|
Reserved keywords
If we have custom keywords, such as {type: "websocket-client", config: {address: "wss://example.unyt.land"}}Shall we use some special syntax like |
|
1.1 I think "fn" would be a cleaner way, but I already talked to @jonasstrehle about this topic and I fully understand his point. So I agree with using the keyword "function". |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
All reactions