This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Questions for Geiser
- From: Helmut Eller <eller dot helmut at gmail dot com>
- To: kawa at sourceware dot org
- Date: Tue, 07 Apr 2015 09:58:28 +0200
- Subject: Re: Questions for Geiser
- Authentication-results: sourceware.org; auth=none
- References: <87d23g4imi dot fsf at ironoxide dot ca> <5523722A dot 3040507 at bothner dot com>
On Mon, Apr 06 2015, Per Bothner wrote:
> On 04/06/2015 10:23 PM, Dan Leslie wrote:
>> 2. What reflection and completion utilities are available, if any?
One possibility is to enumerate the locations in an environment:
(import (only (kawa regex) regex-match))
(define (completions regex env :: gnu.mapping.InheritingEnvironment)
(let ((result '()))
((env:enumerateAllLocations):forEachRemaining
(lambda (loc)
(cond ((instance? loc gnu.mapping.NamedLocation)
(let* ((sym (loc:getKeySymbol))
(name (sym:getName)))
(cond ((regex-match regex name)
(set! result (cons name result)))))))))
result))
(completions #/^con/ (interaction-environment))
=> ("constant-fold" "cond-expand" "cons" "cond")
Another approach would be to only use "static" analyses ie. use the
compiler to parse source files and work with gnu.expr.Expression trees
without actually loading code. I think the "static" approach is what
Per prefers/recommends and it's also what Eclipse and the like do. If
you want to do sophisticated dependency management and type based
refactoring it's the way to go but for simple things like symbol
completions of top-level bindings it requires much more work than to
inspect the runtime directly.
>> 3. Geiser is very module-centric, and supports behaviours wherein its
>> aware of the R7RS-library or implementation-specific module in which a
>> symbol lays and will rebind it appropriately when a relevant region or
>> other is evaluated. What tools does Kawa provide for, say, declaring the
>> library/module/namespace in which a block is to be evaluated?
>
> Kawa does support R7RS eval and load, where you can specify an
> environment to use,
I think what Dan needs/wants is something like
(eval '(define (my-function x) ...) (environment '(my own module)))
but Kawa doesn't support this.
Correct me if I'm wrong, but I think once a module is defined it can't
be changed because it's essentially compiled down to a JVM class.
Helmut