bit-hack/nano-script

Treat functions as first class types

Closed this issue · 2 comments

This would be useful for registering callbacks and delegates.
We can also implement finite state machines and what not more easily.

The caller would need to pass in an argc parameter, and let the system take care of too many or too few arguments. This would be quite a big ABI change.

The down side of this is that errors from function calls would be harder to verify.
I could verify them for known functions, but it would be a run-time check for non deducible functions.

When passing in too few arguments, we could pad with none types

The ABI now has an argc parameter passed for each function call and syscall so that is one part of the puzzle.
I think we need a new indirect call instruction for when we call a variable so that we can handle any parameter number mismatch between the caller and callee.

done!