Re: include/1 directive

From: Sebastian Sardina <ssardina_at_cs.toronto.edu>
Date: Mon 09 Dec 2002 01:56:45 PM GMT
Message-Id: <1039442205.19699.9.camel@ssardina.com.ar>
On Mon, 2002-12-09 at 08:29, Kish Shen wrote:
> Hi Sabastian,
> 
> >Is there a way of having the *real* include/1 to include a file into
> >another one?
> 
> Not at the moment (at least not within ECLiPSe itself).
> 

Ok.

> >Having a real include is very different
> >from compile/1 and, among other things, one cannot divide the definition
> >of a predicate among different files, etc...
> 
> You can't in general divide the definition of your predicate within the
> same file, so a real include/1 will not really allow you to divide the
> definition of a predicate into different files (except you can start
> one predicate defintion just before the inlcude, and continue it in the
> included file, but this is definitely *not* a good idea). The main

yes I know it's not a good idea, but I don't understand why you say
include does not work for that even if the first clause for the
predicate appears in the included file.

As far as I understand, include/1 should just "expand" like a macro in
the place where it's used.

so if I have that file1.pl is:

a(1).
a(2).

then file2.pl:

:- include(file1)
a(3).

should be exactly equivalent to have a file3.pl:

a(1).
a(2).
a(3).


here the first clause a(1) appears in the included file. Am I wrong?


> difference between a real include/1 and compile/1 is in the treatment
> of modules as described in the documentation.

yes that's my actual problem in fact.

> If you really want to spread the definition of a predicate in several files
> (but within the same module), you can declare it to be dynamic. However,
> in general, it is probably a bad idea to spread the definition of a 
> predicate into several files (you are much more likely to make mistakes,
> forget to update one part while you update the other, etc.).

yes I agree but in some particular cirumstances it may be helpful.

> 
> Cheers,
> 
> Kish Shen


THanks 

Sebastian
Received on Mon Dec 09 13:57:57 2002

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