You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ribbit's feature system is currently binary. Features can either be activated (#t) or disactivated (#f). The liveness analysis activates or deactivates them in order to only include what is needed in the final executable.
However, in some cases, we would want features to have other values than #t or #f. This is useful in multiple cases :
For the @@(replace ...)@@ annotation that can insert compile-time known values in the host RVM. This is useful for the specialized encoding, where the compiler has some information about shared encoding parameters that need to be inserted in the host
In the case of bignums, we want the hosts to be able to specify what is the maximum size for an "integer" that lives inside a rib. The library can then adapt to create bignums after this maximum value is reached.
Syntax
The only construct that need modification is the use construct. We can now specify values as s-exps pairs. Here are a few examples :
example 1 : (define-primitive (square x) (use (foobar 42)))
Here, if the primitive "square" is used, the foobar feature will have the value of 42
example 2 : (define-feature hey (use (baz 42)) ((decl "console.log('hey');")))
Here, if the hey feature is used, the baz feature will have the value 42
example 3 : (use-feature my-true-feature (my-other-value-feature 42))
Here, the feature my-true-feature will have a value of #t and my-other-value-feature will have a value of 42.
The text was updated successfully, but these errors were encountered:
Rationale
Ribbit's feature system is currently binary. Features can either be activated (
#t
) or disactivated (#f
). The liveness analysis activates or deactivates them in order to only include what is needed in the final executable.However, in some cases, we would want features to have other values than
#t
or#f
. This is useful in multiple cases :@@(replace ...)@@
annotation that can insert compile-time known values in the host RVM. This is useful for the specialized encoding, where the compiler has some information about shared encoding parameters that need to be inserted in the hostSyntax
The only construct that need modification is the
use
construct. We can now specify values as s-exps pairs. Here are a few examples :example 1 :
(define-primitive (square x) (use (foobar 42)))
Here, if the primitive "square" is used, the
foobar
feature will have the value of 42example 2 :
(define-feature hey (use (baz 42)) ((decl "console.log('hey');")))
Here, if the
hey
feature is used, thebaz
feature will have the value42
example 3 :
(use-feature my-true-feature (my-other-value-feature 42))
Here, the feature
my-true-feature
will have a value of#t
andmy-other-value-feature
will have a value of 42.The text was updated successfully, but these errors were encountered: