Skip to content

How to call native function from typescript #650

Answered by mmoskal
xmeow asked this question in Q&A
Discussion options

You must be logged in to vote

This are pretty much the only two ways, and you correctly identified the trade-offs. For the 1st one you can implement a Jacdac action, not a property, but it's pretty much the same thing. It is the recommended way for use cases where speed is not critical.

Note that similar interpreters, like MicroPython, only have the second option.

One thing that we could do to improve the second option, is to allow arbitrary strings to refer to runtime methods and objects. That would mean you wouldn't have to update bytecode.md but could instead check for existence of a method/object in normal JavaScript ways and fall back to some other behavior. However, there are no immediate plans to do it and I'm …

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by xmeow
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants