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

Re: [Scheme-reports] Formal definitions [con'd]

Alex Shinn <alexshinn@x> wrote:

> On Fri, Nov 30, 2012 at 8:29 AM, Jean-Michel HUFFLEN
> <jmhuffle@x>wrote:
> (...)
>> - p. 70, "define-values"; the 1st clause
>> ((define-values () expr) ...)
>> seems to me to be useless, "define-values" cannot be used with an
>> empty list of variables, and no recursive call yields this situation;
> It's unlikely you would intentionally do this, but it is allowed
> by the specification - define-values can take any formals list,
> including an empty list.

    OK, but I have two questions. In such a case:

(define-values () expr)

we could consider that "expr" is produced, but not consummated by any  
variable. In other words, an expansion could be:

(call-with-values (lambda () expr)
   (lambda args (if #f #f)))

    Second question: if the expansion is:

(define dummy
   (call-with-values (lambda () expr)
     (lambda args #f)))

let us consider the two following expressions:

(let ()
   (define dummy '*something*)
   (define-values () '*another-thing*)

(let ()
   (define-values () '*something*)
   (define dummy another-thing*)

and let us recall that in such a case, all the variables introduced by  
means of "local" "define" must be pairwise-different. In the first  
case, that works because  Scheme macros are hygienic and the variable  
"dummy" introduced by "define-values"' expansion is renamed. But what  
about the second? When the "define-values" macro is expanded, "dummy"  
is not known within the environment, is it? Or am I missing something?



This message was sent using IMP, the Internet Messaging Program.

Scheme-reports mailing list