This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Questions for Geiser
- From: Dan Leslie <dan at ironoxide dot ca>
- To: Helmut Eller <eller dot helmut at gmail dot com>
- Cc: kawa at sourceware dot org
- Date: Tue, 07 Apr 2015 10:08:40 -0700
- 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> <m2fv8c9xp7 dot fsf at gmail dot com>
- Reply-to: dan at ironoxide dot ca
Helmut Eller <eller.helmut@gmail.com> writes:
> 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")
This is exactly what I was looking for.
> 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.
That's not an approach that's quite in-line with how Geiser is tailored;
it's more of a suite of tools to extend the REPL into your editing
buffers. The act of repeatedly injecting sexps into the REPL and so
modifying the active environment is central.
Type-based refactoring and dependency management isn't within the scope
of the mode, just yet.
> I think what Dan needs/wants is something like
>
> (eval '(define (my-function x) ...) (environment '(my own module)))
>
> but Kawa doesn't support this.
Hmm, that's what I was looking for. No matter, we've already set
precedent for enabling/disabling features on a per-scheme basis.
Thanks!
--
-Dan Leslie