Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Unknown Abstract function value

Herman Venter edited this page Jun 20, 2017 · 1 revision

An unknown value of type function can be created by means of an expression that calls the global function __abstract.

The argument can simply be the string "function" to indicate that the result is a function without any other information specified about it, or it can be an actual function expression, which makes it possible to specify a signature.

For example global.__abstract("function") results in an abstract function value of which nothing further is known, whereas __abstract(function(x,y) {}) results in an abstract function which is known to expect two arguments.

IMPORTANT: Abstract function values specified this way are expected to be well behaved, which is to say that they may not change the heap in observable ways and they may not throw exceptions. Since Prepack does not have the function body available to it when it runs, it assumes that the function is well behaved and carries on assuming that the code that follows a call to this function will always resume execution and will always find the heap to be as it was before the function call.

If this condition is not met, then running Prepack over a program contain a call to such a function will changes the program's runtime behavior in subtle and unpredictable ways.