I seem to have trashed about a dozen recent e-mail messages, including this one, but here's a reply:
Are these declarations documented anywhere, I can't seem to find it in gambits distributed docs.
See also (declare (core)) and (declare (not core)).
Use The Source, Luke. Marc, these really should be documented unless you think they're a hack and will be eliminated in the near future.
In gsc/_ptree1.scm, we find:
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; Declarations. <stuff omitted> ; Compilation strategy declarations: ; ; (block) global vars defined are only mutated by code in the current file ; (separate) global vars defined can be mutated by other code ; ; (core) toplevel expressions and definitions must be compiled to code ; (not core) toplevel expressions and definitions belong to another module
And see how it's used in the compiler. For example, there's _envadt.scm, which defines Abstract Data Types for use in _env.scm, but which are also used in other files. So in _env.scm we find
_env.scm:(include "_envadt.scm")
while in other files that use the accessors, setters, etc., defined in _envadt.scm we find
_back.scm:(include-adt "_envadt.scm") _env.scm:(include "_envadt.scm") _front.scm:(include-adt "_envadt.scm") _gvm.scm:(include-adt "_envadt.scm") _ptree1.scm:(include-adt "_envadt.scm") _ptree2.scm:(include-adt "_envadt.scm") _source.scm:(include-adt "_envadt.scm") _t-c-1.scm:(include-adt "_envadt.scm") _t-c-2.scm:(include-adt "_envadt.scm") _t-c-3.scm:(include-adt "_envadt.scm") _utils.scm:(include-adt "_envadt.scm")
while include-adt is defined by
(##define-macro (include-adt filename) `(begin (##declare (not core)) (##include ,(string-append "../gsc/" filename)) (##declare (core))))
So the definitions in files included with "include-adt" can be inlined, etc., in the surrounding source files, which is important for speed, but code for these standalone accessors will be defined only in _env.scm.
Brad
Afficher les réponses par date