* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Implement guile-primitive.
* test-suite/tests/elisp-compiler.test: Switched a usage of guile-ref to
the now available guile-primitive.
for void value on access either completely or for some symbols
Extensions over original elisp:
- * guile-ref
+ * guile-ref, guile-primitive
* flet and flet*
* lexical-let and lexical-let*
Details to the implemented extensions
=====================================
-guile-ref:
-----------
+guile-ref and guile-primitive:
+------------------------------
(guile-ref module sym) is a new special construct to access symbols from the
-Guile-world (for instance, Guile primitives directly but it also allows to
-set some variables in other modules than the elisp runtime ones).
+Guile-world. Actually, (guile-ref module sym) is the same as (@ module sym)
+would be in Scheme. Both module and sym must be statically given and are not
+evaluated.
-Actually, (guile-ref module sym) is the same as (@ module sym) would be in
-Scheme. Both module and sym must be statically given and are not evaluated.
+(guile-primitive sym) does the same to access a Guile primitive directly, which
+is slightly faster where applicable.
flet and flet*:
---------------
(generate-let* loc function-slot bindings body))
; guile-ref allows building TreeIL's module references from within
- ; elisp as a way to access data (and primitives, for instance) within
+ ; elisp as a way to access data within
; the Guile universe. The module and symbol referenced are static values,
; just like (@ module symbol) does!
((guile-ref ,module ,sym) (guard (and (list? module) (symbol? sym)))
(make-module-ref loc module sym #t))
+ ; guile-primitive allows to create primitive references, which are still
+ ; a little faster.
+ ((guile-primitive ,sym) (guard (symbol? sym))
+ (make-primitive-ref loc sym))
+
; A while construct is transformed into a tail-recursive loop like this:
; (letrec ((iterate (lambda ()
; (if condition
(lambda ()
(setq cnt (1+ cnt)))))
(setq c1 (make-counter) c2 (make-counter))
- (= ((guile-ref (guile) apply) c1 '()) 1)
- (= ((guile-ref (guile) apply) c1 '()) 2)
- (= ((guile-ref (guile) apply) c1 '()) 3)
- (= ((guile-ref (guile) apply) c2 '()) 1)
- (= ((guile-ref (guile) apply) c2 '()) 2)
- (= ((guile-ref (guile) apply) c1 '()) 4)
- (= ((guile-ref (guile) apply) c2 '()) 3))))
+ (= ((guile-primitive apply) c1 '()) 1)
+ (= ((guile-primitive apply) c1 '()) 2)
+ (= ((guile-primitive apply) c1 '()) 3)
+ (= ((guile-primitive apply) c2 '()) 1)
+ (= ((guile-primitive apply) c2 '()) 2)
+ (= ((guile-primitive apply) c1 '()) 4)
+ (= ((guile-primitive apply) c2 '()) 3))))
(with-test-prefix/compile "defconst and defvar"