[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Commercial development
From: |
Neil Jerram |
Subject: |
Re: Commercial development |
Date: |
Wed, 08 Jun 2005 20:03:17 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 |
Neil Jerram wrote:
>
> I'm not sure it's that obscure, and it seems a shame to leave this as
> ammunition for those who like to claim that Guile is not R5RS-compliant.
Another possibility would be to do what SCM does. If I understand
correctly, SCM does the list construction that we have noted as being
necessary to pass the test, but compensates by not building the init
values into a list to begin with.
Instead, it builds the init values onto the stack, by using a recursive
function like this:
static void ecache_evalx(x)
SCM x;
{
SCM argv[10];
int i = 0, imax = sizeof(argv)/sizeof(SCM);
scm_env_tmp = EOL;
while NIMP(x) {
if (imax==i) {
ecache_evalx(x);
break;
}
argv[i++] = EVALCAR(x);
x = CDR(x);
}
ENV_V2LST((long)i, argv);
}
The ENV_V2LST at the end then conses all the values on the stack into a
list, and the calling code finishes things off by inserting that list
into the extended environment.
Cunning, isn't it? It passes the test because a continuation captured
during an ecache_evalx call will preserve the values on the stack, and
because the values on the stack are not affected by set!s on the letrec
environment.
What do you think? It seems like a very self-contained trick, so I
think we could easily copy it to Guile.
Neil