guile-user
[Top][All Lists]
Advanced

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

Re: modules, 2nd try.


From: Han-Wen Nienhuys
Subject: Re: modules, 2nd try.
Date: Wed, 18 Sep 2002 21:19:20 +0200

address@hidden writes:
> 
> in the first frag, there is "% variableTwo not visible here." but not in
> the second frag.  could you clarify your intention?

Sorry. % is a comment; First assignment implies a definition, like
python does.

>    In terms of code, I want to create sets of bindings. The sets should
>    be nested, and available to the Scheme evaluator.
> 
> should inner bindings shadow outer bindings?

Haven't thought of this, and I don't think I favor any choice over
another.  In our input language, I guess yes, but of course not in
pure Scheme.

>    How do I do this?  I tried mucking about with modules, but I can't
>    even get the basic functionality working, and they seem a bad match
>    with my wishes, since definitions in modules are private by default,
>    and the name spaces are not nested.
> 
> probably if we can refine your wishes to more precise specification, an
> approach will suggest itself.

To my feeling, the way scopes work in Scheme is ok (where lambda
introduces an inner scope),

        (define variableOne 1.0)
        (define (foo x)
                (define variableTwo 5.0)
                (do-side-effect (* variableTwo variableOne))
                )


Within (foo .. ) you can define a new variable that is not visible
outside (foo ..), and variableOne (defined outside foo ), is visible
inside (foo ..)  Unfortunately, the Scheme evaluator needs to read the
entire expression before it can do the evaluation, I don't see how I
can combine that with the Yacc based parser in a simple way.

-- 
Han-Wen Nienhuys   |   address@hidden   |   http://www.cs.uu.nl/~hanwen 




reply via email to

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