This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A module system question.


mike@olan.com (Michael N. Livshin) writes:

> There is one solution, but it's *very* unclean. You can simply redefine
> `define' & `define-public', so they will bind the value of (current-module)
> to a variable with some agreed-upon name.

Hmm, do you like this one better?

    (defmacro define-my-module args
      `(let ((module (process-define-module ',args)))
	 (module-define! module 'my-module (lambda () module))
	 (set-current-module module)
	 module))

    (define-my-module (used-module))

    (define-public (fun)
      (my-module))

But I think using (current-module) is sufficient for all cases.