Re: How to use predicate of library w/o loading the library?

From: <wh_at_icparc.ic.ac.uk>
Date: Mon 06 Dec 2004 06:23:06 PM GMT
Message-ID: <20041206182305.GC26959@tempest.icparc.ic.ac.uk>
Hi Ulrich,

What you need to do to avoid the warning is to make sure that the iso module
has already been loaded before the first time you try to call
unify_with_occurs_check/2.  This is just a case of adding

    :- ensure_loaded(iso).

to your file.  This makes sure the module has been loaded, but does not
import it.

What you're doing currently is not wrong; there are a number of ECLiPSe
libraries that deliberately defer loading other libraries until they're
actually needed.  Typically this is because it will be rare for the other
libraries to be needed, and this way if they're not actually needed they
won't be loaded and won't consume memory, etc.

Cheers,
Warwick

On Mon, Dec 06, 2004 at 04:33:42PM +0100, Ulrich Scholz wrote:
> Dear all,
> 
> I like to use unify_with_occurs_check of the iso library - but I don't
> want to load that library: It messes up Strings.  Furthermore, do/2 is
> broken.
> 
> By now, I use
> 
> :- (import (unify_with_occrs_check)/2 from iso).
> 
> This works as it allows to use the predicate without the negative side
> effects of loading iso.  But, it produces the warning
> 
> WARNING: module 'iso' does not exists, loading library...
> 
> I guess, I'm doing something wrong.  How to do it better?
> 
> Thank you, Uli
> -- 
> Ulrich Scholz
> 
> scholz@informatik.tu-darmstadt.de
> http://www.intellektik.informatik.tu-darmstadt.de/~scholz
> 
> 
> 
Received on Mon Dec 06 18:25:44 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:31 PM GMT GMT