For Programmers: Free Programming Magazines  


Home > Archive > Scheme > March 2004 > Re: environment of a procedure









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: environment of a procedure
Marlene Miller

2004-03-28, 12:01 am

Thank you Barry. (Please excuse my late response. I thought my question got
lost, so I didn't look for answers.)

"Richard C. Cobbe" <cobbe@ccs.neu.edu> wrote in message
news:t2p8yi4q3uv.fsf@denali.ccs.neu.edu...
> "Marlene Miller" <marlenemiller@worldnet.att.net> writes:
>
environment of[color=darkred]
>
> Not necessarily, no. One could argue that p is closed over the top-level
> environment, and that (define y 20) mutates this top-level environment, so
> any new definitions are visible by p.
>
> One can certainly implement Scheme in this fashion, although there are
> other strategies.
>
> As a side note, ML has different behavior here. As I understand it,
> top-level definitions are visible only from the point of definition
> onwards, so the ML equivalent of the above program won't compile. (This

is
> in part because, without a definition for y, the compiler can't type-check
> p.)
>
> Richard



Marlene Miller

2004-03-28, 12:01 am

Thank you Ben. (Please excuse my late response. I thought my question got
lost, so I didn't look for answers.)

"Ben Rudiak-Gould" <benrg@darkweb.not-this-part.com> wrote in message
news:f6v650him5un3u2hjv4d2p9brgab2vs3r0@
4ax.com...
> On Fri, 12 Mar 2004 21:09:08 GMT, "Marlene Miller"
> <marlenemiller@worldnet.att.net> wrote:
>
of[color=darkred]
>
> I think your example works because there is a binding in effect for y
> when the procedure is created, as permitted in section 5.2.1:
>
> | Some implementations of Scheme use an initial environment in which all
> | possible variables are bound to locations, most of which contain

undefined
> | values. Top level definitions in such an implementation are truly
> | equivalent to assignments.
>
> Every implementation of Scheme I've used seems to behave in this way,
> but I don't think that R5RS requires it.
>
> -- Ben
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com