Skip to content

What is Native and how is it used? #56

Answered by AttilaMihaly
DamianReeves asked this question in Q&A
Discussion options

You must be logged in to vote

Very timely question. @piyush-gupta1999, our most productive contributor just told me yesterday that we should document this. I'll give a high-level description here and will add code comments as well.

Functions in the Native module are called by the interpreter when it hits an SDK function. Things like adding or comparing two numbers cannot be implemented using the Morphir IR itself so we call the built-in SDK functions but we are working with Values in the interpreter so we have to unwrap, get the literal value out. invoke the SDK function and wrap the result back to a Value before returning. The Native module contains types that describe the interface for native functions and also help…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@DamianReeves
Comment options

@AttilaMihaly
Comment options

Answer selected by AttilaMihaly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants