[Top][All Lists]

[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: Fri, 20 Sep 2002 11:25:21 +0200

address@hidden 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. 

        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 
                                                         gh_car (s), 


          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   |   address@hidden    |

reply via email to

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