From: Han-Wen Nienhuys <hanwen@cs.uu.nl>
Cc: guile-user@gnu.org
Subject: Re: modules, 2nd try.
Date: Fri, 20 Sep 2002 11:25:21 +0200 [thread overview]
Message-ID: <15754.59777.585302.757918@meddo.cs.uu.nl> (raw)
In-Reply-To: <m3n0qdvg01.fsf@laruns.ossau.uklinux.net>
neil@ossau.uklinux.net writes:
> [..]
Thanks, I more or less came up with something alike yesterday evening
-- one of the other problems was that I didn't do scm_c_export() of
the symbols, which drove me up the walls ( "why isn't it seeing my
definitions...? ")
> Han-Wen> \score {
>
> Moving into a sub-scope, so ...
>
> (define submodule (resolve-module (next-module-name)))
> (beautify-user-module submodule)
>
> (module-use! submodule (module-public-interface lily-current-module))
>
> ;; At this point you want to mark all the variables imported from
> ;; lily-current-module for re-export. I'm not sure how you could do
> ;; this. Perhaps something involving module-map or module-for-each.
Ah, of course, I could batch these exports.
> lily-current-module; so you'll need to keep a stack of
> lily-current-modules.
>
> As usual, I haven't actually tested any of this (!) If you want to
> see working examples of manual module munging code (although with
> different aims from yours, kind of), look at `use-elisp-file' in
> lang/elisp/interface.scm and `fset' in lang/elisp/internals/fset.scm,
> both in CVS.
>
> Hoping this helps ...
Yes, thanks. Most of the code involved is triggered from the C part of
the code, but I noticed that most of the module system actually lives
in the SCM system, so perhaps it doesn't make much of a difference?
I think you left out the part where the new scope imports the old
(nested) scopes, i.e.
void
My_lily_lexer::add_scope (SCM module)
{
scm_set_current_module (module);
for (SCM s = scopes_; gh_pair_p (s); s = gh_cdr (s))
{
SCM expr = scm_list_n (ly_symbol2scm ("module-use!"),
module, scm_list_n (ly_symbol2scm ("module-public-i
nterface"),
gh_car (s), SCM_UNDEFINED),
SCM_UNDEFINED);
scm_primitive_eval(expr);
}
scopes_ = scm_cons (module, scopes_);
Does your suggestion to use modules mean that there is no other
natural way to implement these nested scopes?
--
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
next prev parent reply other threads:[~2002-09-20 9:25 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
2002-09-19 21:14 ` Neil Jerram
2002-09-20 9:25 ` Han-Wen Nienhuys [this message]
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=15754.59777.585302.757918@meddo.cs.uu.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).