chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] extending define-values


From: Alex Shinn
Subject: Re: [Chicken-hackers] extending define-values
Date: Tue, 9 Apr 2013 21:15:47 +0900

On Tue, Apr 9, 2013 at 1:28 PM, Felix <address@hidden> wrote:
From: Alex Shinn <address@hidden>
Subject: Re: [Chicken-hackers] extending define-values
Date: Tue, 9 Apr 2013 08:29:38 +0900

> 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

This requires letrec* semantics for internal definitions and is not
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.

Aha - we're talking about two entirely different things.

I was replying to Peter Bex's comment that it would be
difficult/impossible for the r7rs egg to provide it's own
define-values, pointing out that the reference impl can be
used as-is.  In this context, nothing could be more relevant.

I made no comments about the core Chicken define-values - I'd
prefer you not change your core for the sake of this feature.

-- 
Alex


reply via email to

[Prev in Thread] Current Thread [Next in Thread]