public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Dan Leslie <dan@ironoxide.ca>
To: Helmut Eller <eller.helmut@gmail.com>
Cc: kawa@sourceware.org
Subject: Re: Questions for Geiser
Date: Tue, 07 Apr 2015 17:08:00 -0000	[thread overview]
Message-ID: <874mor50iv.fsf@ironoxide.ca> (raw)
In-Reply-To: <m2fv8c9xp7.fsf@gmail.com>


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

  reply	other threads:[~2015-04-07 17:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07  5:23 Dan Leslie
2015-04-07  5:59 ` Per Bothner
2015-04-07  7:58   ` Helmut Eller
2015-04-07 17:08     ` Dan Leslie [this message]
2015-04-07 18:43     ` Per Bothner
2015-04-07 17:04   ` Dan Leslie
2015-04-07 19:01     ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874mor50iv.fsf@ironoxide.ca \
    --to=dan@ironoxide.ca \
    --cc=eller.helmut@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).