|
From: | Alex Shinn |
Subject: | Re: [Chicken-hackers] extending define-values |
Date: | Tue, 9 Apr 2013 21:15:47 +0900 |
Date: Tue, 9 Apr 2013 08:29:38 +0900
This requires letrec* semantics for internal definitions and is not
> On Tue, Apr 9, 2013 at 8:16 AM, Alex Shinn <address@hidden> wrote:
>
>> On Tue, Apr 9, 2013 at 6:49 AM, Felix <
>> address@hidden> wrote:
>>
>>> >> "define-values" can not simply expand into a bunch of "defines".
>>> >> To allow it to be intermixed with "define" in internal definitions,
>>> >> it needs be special cased, due to the use of "call-with-values" (which
>>> >> would "break" the sequence of definitions and treat all following
>>> >> forms of the body as non-definitions). Or not?
>>> >
>>> > No, the call to call-with-values is wrapped in a definition too.
>>> > It really is turtles all the way down.
>>> >
>>> >> BTW, where can I find the portable reference implementation you
>>> >> mentioned?
>>> >
>>> > In Section 7.3 of the ninth draft, pp. 69-70. Unfortunately,
>>> > trac.sacrideo.us seems to be down, but it's normally at
>>> > <
>>> http://trac.sacrideo.us/wg/raw-attachment/wiki/WikiStart/r7rs-draft-9.pdf
>>> >.
>>> > There's a temporary copy at <
>>> http://www.ccil.org/~cowan/temp/r7rs-draft-9.pdf>.
>>>
>>> Very clever, indeed. Thanks for the link. Rather inefficient,
>>> but clever.
>>>
>>
>> Sorry, what I described was a variation of the same theme.
>> If you do what I described instead of what I coded, and be
>> sure to pass a lambda with the same signature (in temp vars)
>> as the define-values to call-with-values then there is zero
>> overhead.
>>
>
> Note the following implementation from 2007 follows this approach:
>
> http://permalink.gmane.org/gmane.lisp.scheme.gauche/1051
valid in R5RS. So I'm not sure this is relevant to the discussion. It
might work in chicken (which uses letrec* semantics anyway), but it
still is invalid code. To allow checking for such cases statically and
for possible later optimizations it is better to avoid doing this.
[Prev in Thread] | Current Thread | [Next in Thread] |