]> ocean-lang.org Git - ocean/commitdiff
oceani: Add functions
authorNeilBrown <neil@brown.name>
Sun, 7 Nov 2021 21:21:30 +0000 (08:21 +1100)
committerNeilBrown <neil@brown.name>
Fri, 12 Nov 2021 23:09:44 +0000 (10:09 +1100)
As yet, functions cannot return a value, but they can be passed
parameters.
They are declared a bit like consts, but there isn't a common
header for multiple constants.

A pointer to the body of the function is stored in the 'global' area,
like the vale of any other constant.

Functions can be called as a statement - providing they don't return
anything - or as an expression, which will currently be a type error as
they cannot return the correct type.

We allocate a new 'local' frame for each function call, and free it when
the function completes.

Signed-off-by: NeilBrown <neil@brown.name>

No differences found