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

Re: circular module uses




Gabor Greif wrote:
> If I have a library with three modules (sketch):
> 
> define library L
>  use dylan;
> 
>    export a,b,c;
> end;
> 
> define module a
>    export xxx;
> end;
> 
> define module b
>   use a;
>   use c;
>    export yyy;
> end;
> 
> define module c
>    export zzz;
> end;
> 
> Is it intended that module \b has access to \zzz from module \c ???

 I am not sure if the order you provide is supported, but if you
reorder this, I do not see any problem:
----------------
define module a
   export xxx;
end;

define module c
   export zzz;
end;
 
define module b
  use a;
  use c;
 export yyy;
end;
----------------

 However I believed that this is not what you intended to test.

> I.e. Is it admissible that modules of a library have circular
> (forward) use dependencies?

 No, the DRM forbids this. Modules & Libraries usage must be
acyclic (sorry I do not have the DRM with me to quote the source).

 Note however that you do not have circular dependencies here,
just a forward  one. I do not remember any explicit mention that
this should be disallowed.

> My idea is that this should be allowed. Is there a reason to forbid it?

 Forward references: maybe for implementation sake, but I'd be surprised
if the language rules them out.

 Circular references: yes, there are many reasons to forbid this.

> GD does not complain about it at least, but does not see \zzz from
> inside \b either. I guess this is a bug.

 Either a bug or a non-feature that isn't flagged :-)

 Regards - Eric

-- 
Eric Gouriou                             egouriou@cup.hp.com