unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Han-Wen Nienhuys <hanwen@cs.uu.nl>
Cc: guile-user@gnu.org
Subject: Re: modules, 2nd try.
Date: Wed, 18 Sep 2002 21:19:20 +0200	[thread overview]
Message-ID: <15752.53688.195022.884154@blauw.xs4all.nl> (raw)
In-Reply-To: <E17rk0H-00027M-00@giblet>

ttn@giblet.glug.org 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   |   hanwen@cs.uu.nl   |   http://www.cs.uu.nl/~hanwen 


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


  reply	other threads:[~2002-09-18 19:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-17 22:18 modules, 2nd try Han-Wen Nienhuys
2002-09-18 18:56 ` Thien-Thi Nguyen
2002-09-18 19:19   ` Han-Wen Nienhuys [this message]
2002-09-19 21:14 ` Neil Jerram
2002-09-20  9:25   ` Han-Wen Nienhuys
2002-09-20 18:42     ` Neil Jerram
2002-09-21 11:15       ` Han-Wen Nienhuys
2002-09-21 11:22         ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15752.53688.195022.884154@blauw.xs4all.nl \
    --to=hanwen@cs.uu.nl \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).