inline is a toplevel attribute on definitions, as well as
a call-site hint around an application.
Syntax
;; toplevel attribute
(inline)
(define ...)
;; applicationm hint
(inline (⟨function⟩ ⟨arg⟩ ...))
Semantics
- As a standalone attribute,
(inline)must appear immediately beforedeclare,define, or an instance method definition. - On a definition, it requests that Coalton inline the function at all sites.
- As an expression,
(inline application)asks Coalton to inline that syntactic function application if possible. inlineis a performance hint and should not change observable behavior.
Example
(coalton-toplevel
(inline)
(define (double x)
(+ x x))
(define (triple x)
(+ x (double x)))
(define (sextuple x)
(inline (triple (double x)))))