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: Felix
Subject: Re: [Chicken-hackers] extending define-values
Date: Mon, 08 Apr 2013 22:40:04 +0200 (CEST)

>> >> > If you wanted to go this route you could just grab the portable
>> >> > reference implementation of define-values, no need to touch
>> >> > internals.
>> >>
>> >> This wouldn't work for internal definitions, I think. Is "define-values"
>> >> allowed for local definitions in R7RS?
>> >>
>> >
>> > It's just syntax which expands into internal definitions.
>> > The only way it could not work is with an implementation
>> > which looks for internal defines statically before expanding
>> > the lambda body.

"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? At least I can't
think of any other solution than treating it explicitly.

BTW, where can I find the portable reference implementation you
mentioned?

>>
>> What about detection for redefinitions of defining forms
>> ("define-values" in this case)? Wouldn't that need special handling?
>>
> 
> That's an error according to the standard, section 5.4:
> 
>   "... it is an error for a definition to define an identifier whose
> binding has to
>    be known in order to determine the meaning of the definition itself..."
> 
> with the standard R5RS error examples including
> 
>   (define define 3)
> 

Yes, I've heard of that before. What about

  (define-values define-values 3)

?


cheers,
felix



reply via email to

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