execute top level require forms
[bpt/guile.git] / module / language / elisp / README
CommitLineData
51248e6e
DK
1Guile's Emacs Lisp compiler
2===========================
3
4This is more or less a lot of work in progress. Here are some notes as well
5as status information.
6
7Already implemented:
fb66a47a 8 * progn, prog1, prog2
7d1a9782
DK
9 * if, cond, when, unless
10 * not, and, or
344927c3 11 * referencing and setting (setq) variables
37099846
DK
12 * set, symbol-value, makunbound, boundp functions
13 * fset, symbol-function, fmakunbound, fboundp
e96a9591
DK
14 * funcall, apply (also with raw lists as arguments and the like!)
15 * eval
fb66a47a 16 * while, dotimes, dolist
33da12ee 17 * catch, throw, unwind-protect
3a4b8635 18 * let, let*
cef997e8 19 * lambda expressions, function calls using list notation
1e018f6c 20 * some built-ins (mainly numbers/arithmetic)
de9f26b5 21 * defconst, defvar, defun
74c009da 22 * macros
9b5ff6a6 23 * quotation and backquotation with unquote/unquote-splicing
e840cc65 24 * specific elisp reader
51248e6e
DK
25
26Especially still missing:
de9f26b5 27 * more general built-ins
09241ea7
DK
28 * advice?
29 * defsubst and inlining
74c009da
DK
30 * recursive macros
31 * anonymous macros
fb66a47a
DK
32
33Other ideas and things to think about:
92a61010 34 * #nil vs. #f/'() handling in Guile
a0899974
DK
35
36Compiler options implemented:
37 * #:disable-void-check ['all / '(sym1 sym2 sym3)] to disable the check
38 for void value on access either completely or for some symbols
c808c926
DK
39 * #:always-lexical (usable same as disable-void-check) to always bind
40 certain or all symbols lexically (including lambda arguments)
33da12ee
DK
41
42Extensions over original elisp:
c61ec8e2 43 * guile-ref, guile-primitive
e8f18b3f 44 * flet and flet*
a6a5cf03 45 * lexical-let and lexical-let*
c808c926 46 * without-void-checks, with-always-lexical
a6a5cf03
DK
47
48
49Details to the implemented extensions
50=====================================
51
c61ec8e2
DK
52guile-ref and guile-primitive:
53------------------------------
a6a5cf03
DK
54
55(guile-ref module sym) is a new special construct to access symbols from the
c61ec8e2
DK
56Guile-world. Actually, (guile-ref module sym) is the same as (@ module sym)
57would be in Scheme. Both module and sym must be statically given and are not
58evaluated.
a6a5cf03 59
c61ec8e2
DK
60(guile-primitive sym) does the same to access a Guile primitive directly, which
61is slightly faster where applicable.
a6a5cf03
DK
62
63flet and flet*:
64---------------
65
66These constructs behave exactly like let and let*, except that they bind the
67function slots rather than the value slots, and so make dynamic scoping
68available for functions, too.
69
70The distinction between flet and flet* is probably less useful than the one
71between let and let*, but it was easy to implement both flet and flet*
72based on the existing let and let* code, so not having both of them seemed
73a little inconsistent.
74
75lexical-let and lexical-let*:
76-----------------------------
77
78lexical-let and lexical-let* are constructs provided by the elisp package
79'cl originally, but in Guile they are natively implemented because using
80lexical instead of dynamic binding gives better performance in this case.
81
82They work just like let and let*, but bind their target symbols lexically.
83Some oberservations with the Emacs 'cl implementation that we mimic in Guile
84for compatibility:
85
86 * Ordinary let's within the lexical scope of a lexical-let still establish new
87 *lexical* bindings for symbols already lexically bound. So once lexical,
88 always lexical (on a per-symbol basis).
89
90 * However, lambda constructs within the lexical scope of a lexical-let where
91 one of their arguments is already lexically bound still bind it dynamically
92 for their scope.
93
94 * On the other hand, symbols lexically bound that are not rebound via the
95 argument-list build lexical closures just well.
96
97 * If symbols are accessed where they are not known at compile-time (like
98 symbol-value or set primitives), this always refers to the dynamic binding
99 and never the lexical one. That's very nice to the implementor...
f3df67e2
DK
100
101without-void-checks:
102--------------------
103
104Disable void checks in addition to the compiler option for all or some symbols
105in the lexical scope of this construct:
106
107(without-void-checks all body...) or
108(without-void-checks (sym1 sym2 ...) body...
c808c926
DK
109
110with-always-lexical:
111--------------------
112
113As without-void-checks but adds to list of symbols that should always be bound
114lexically. This lexical binding includes lambda arguments (if the symbols
115match up with the list), which can not be bound lexically otherwise.