[Top][All Lists]

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

Re: eval - environment

From: David Pirotte
Subject: Re: eval - environment
Date: Sat, 01 Sep 2001 20:32:27 +0200

         (define-method (load-tuples&build-inst-1 (db-tb-cl-mt <db-tb-cl-mt>) 
           (let* ((cl-name (cl-nme db-tb-cl-mt))
                  (make-form (eval `(make ,cl-name ,@args)
 ==>                               (current-module)

does not "always" work: it is, i think, related to the way the module system 


        - 10 modules, each module using all previously defined one
        - that 'load-tuples&build-inst-1' is defined in module 3
        - in module 10, the gui has a combo that when used by the
          user, calls 'load-tuples&build-inst-1'


if the module 10 is not defined as a module, but just have the 'use-modules
forms at top-level in the file, such as:

      (use-modules <1>)
      (use-modules <9>)

      the code of the 10th "module" comes here
      ===> it works

but if:
the module 10 is defined as is:

    (define-module (alto tactus rent)
      :use-module <1>
      :use-module <9>)
    ===> then the applications triggers an error when the user plays
         with the combo

    <unnamed port>: In expression (make <chantiers> #:oid ...):
    <unnamed port>: Unbound variable: make
    ABORT: (unbound-variable)

is this the expected behavior?

David Pirotte wrote:
> Hi,
> I still have problem with the following code:
>         (define-method (load-tuples&build-inst-1 (db-tb-cl-mt <db-tb-cl-mt>) 
> args)
>           (let* ((cl-name (cl-nme db-tb-cl-mt))
>                  (make-form (eval `(make ,cl-name ,@args)
> ==>                               ???
>                                   )))
>             make-form))
> i would like eval to use the environment of the caller, here 
> load-tuples&build-inst-1,
> because it contains (it should) everything needed and also will 'put' the 
> evaluated
> forms in the right environment, no? so, how can i tell eval to do that?
> Neil Jerram suggested
>         (define this-module (current-module))
>         and then use `this-module' as the second eval argument rather than
>         `(interaction-environment)'
> but that is not satisfying because i don't know yet at read time what is
> the module (environment) where the method will be executed in
> i could not find doc about 'local-environment and  i am a little bit confused 
> because
> i was making the assumption that unless otherwise specified, eval would 
> precisly use
> the local-environment
> manythanks for some hints,
> david

reply via email to

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