unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Daniel Kraft <d@domob.eu>
To: Andy Wingo <wingo@pobox.com>
Cc: Neil Jerram <neil@ossau.uklinux.net>, guile-devel <guile-devel@gnu.org>
Subject: Re: %nil once again
Date: Fri, 24 Jul 2009 08:20:15 +0200	[thread overview]
Message-ID: <4A69529F.2030606@domob.eu> (raw)
In-Reply-To: <m3r5w7i1dj.fsf@pobox.com>

Hi Andy,

thanks for your comments!

Andy Wingo wrote:
> Reviewing (and merging as much as possible of) your elisp branch is my
> next Guile task, after taking care of that bug recently reported by
> Martin Ward. Should be short work at this point.

Cool!  But just take your time ;)

>> At least, is there some way to construct lists terminated by %nil
>> using something like the list primitive?
> 
> It would need to be something you implement as part of the emacs
> runtime.
> 
> Otoh, (cons* a b c %nil) will do what you want.

Hm, that's an interesting option!  Another comment on this subject had 
been to try without converting the list ends and see how often code 
relys on exactly %nil being the end-of-list anyways, which is what I've 
been doing so far.  But I can give it a try to convert.

>> Other things needed would be for instance terminating rest-arguments
>> by %nil rather than '() and the like.
> 
> Hmmmmm. This is a good question. I think that, on the bytecode side, you
> would have to receive the normal Scheme rest argument, then run through
> it and replace the terminating '() with %nil. So when compiling
> functions that take rest args, they'd have this operation as one of
> their first instructions. There could be a VM op for this if necessary.

Yes, at the moment I already have to do some pre-processing of the rest 
argument at function entry anyways, to handle, for instance, optional 
arguments.  So I can just do the conversion there.

A VM op might be interesting, but as you suggested I'll just write a 
runtime-function and call it; we can do perfomance optimization later on 
when we really know what the problems are.

> On the other other hand... can we enumerate the set of circumstances in
> which we'd want to change a Scheme list to an Elisp list? Call,
> obviously. Probably we want to support tail recursion in calls within
> elisp, so tail calls too. Reading, but the elisp reader has to be
> slightly different anyway. If it's only calls, we can do tricks in the
> VM to make things faster.

I think it would be lists generated by the compiler for certain 
constructs (but I think all of those are only handed to primitives and 
never seen by elisp, so they don't matter), of course the rest arguments 
already mentioned, and most notably return values from primitives that 
return lists -- those need to be converted between the Guile primitive 
and elisp, but that should also be only a call to the conversion routine 
and hopefully not result in too bad performance.

So, maybe a next thing for me will be to work on this conversion.

Yours,
Daniel

-- 
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri




  reply	other threads:[~2009-07-24  6:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-16 13:47 %nil once again Daniel Kraft
2009-07-17  7:59 ` Neil Jerram
2009-07-17  9:02   ` Daniel Kraft
2009-07-17 14:20     ` Andreas Rottmann
2009-07-19 18:28     ` Neil Jerram
2009-07-19 19:44       ` Daniel Kraft
2009-07-19 20:10         ` Neil Jerram
2009-07-20  3:33           ` Ken Raeburn
2009-07-20  8:12             ` Daniel Kraft
2009-07-20  9:15               ` Ken Raeburn
2009-07-23 22:18             ` Andy Wingo
2009-07-20 18:17 ` Clinton Ebadi
2009-07-30 21:38   ` Neil Jerram
2009-07-31  5:03     ` Daniel Kraft
2009-07-23 20:35 ` Andy Wingo
2009-07-24  6:20   ` Daniel Kraft [this message]
2009-07-30 21:50   ` Neil Jerram
2009-07-31  5:05     ` Daniel Kraft

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=4A69529F.2030606@domob.eu \
    --to=d@domob.eu \
    --cc=guile-devel@gnu.org \
    --cc=neil@ossau.uklinux.net \
    --cc=wingo@pobox.com \
    /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).