Good evening (or whatever your local time of day happens to be),
I'm looking into adopting gambit for some hobby projects of mine, and while exploring the documentation and the source code I noticed a few things which puzzled me. If these newbie questions elicit any responses deemed important enough for inclusion in the documentation, I'd be happy to write them up.
1- The documentation for the 'block' declaration states that: "the compiler assumes that global variables defined in the current file that are not mutated in the file will never be mutated". Strictly interpreted, this means that any global variable that *is* mutated in the current file does not benefit from this declaration. In particular, using lexical scoping to hide private variables
(define (foo) 'forward) (define (bar) 'forward)
(let ( ... foo and bar's secret helper functions and variables ...) (set! bar the-real-bar) (set! foo the-real-foo))
would stymie the optimizer. Does it really work that way, or does the declaration imply a stronger assumption, such as no mutation of any bindings outside the current file?
2- Am I correct in interpreting the (not core) declaration as: "the following code is made available to the compiler in case it helps optimization, but this file is not responsible for providing it to outside clients and so the compiler can ignore it if it chooses"?
3- Aside from mentioning a few of the associated error messages, the documentation doesn't discuss the namespace mechanism. Is it meant to be superseded by the R6RS library mechanism? If not, does it have any problems that should discourage mere mortals from using it? On a related note, does the ##foo notation mean "use the compiler's native implementation/interpretation of foo, even if it has been redefined in the current namespace"?
4- I note that the gambit source code (e.g. in _ptreeadt.scm) doesn't use define-structure when creating abstract data types, but rather hand-codes them as vectors with explicit tags. Is this for historical reasons, or are there tradeoffs involved? Are there circumstances under which define-structure should be avoided? I assume that R5RS compliance wasn't a concern in this case.
Thanks for any and all insights,