Does Logtalk support mutual dependency?

Help requests on developing Logtalk applications

Moderator: Paulo Moura

Post Reply
AlexM
Posts: 2
Joined: Wed Apr 10, 2013 10:23 am

Does Logtalk support mutual dependency?

Post by AlexM » Wed Apr 10, 2013 10:41 am

Hi everybody,

Is possible to allow mutual dependencies in logtalk?

I have two objects foo1 with predicate bar1 and foo2 with predicate bar2.

Is possible to write in object foo1

foo2::bar2.

and in object foo2

foo1::bar1.

logtalk_load gives always errors.

Maybe there is an example I can copy in documentation?

Alex

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Does Logtalk support mutual dependency?

Post by Paulo Moura » Wed Apr 10, 2013 11:40 am

Note that you don't get errors, you get warnings. Mutual dependency is supported. The only downside is that static binding will not be possible for the first object compiled as is sending a message to an object that is yet to be compiled.

Cheers,

Paulo

P.S. Logtalk, not LogTalk. Please leave CamelCase to the Java programmers :-)
Paulo Moura
Logtalk developer

AlexM
Posts: 2
Joined: Wed Apr 10, 2013 10:23 am

Re: Does Logtalk support mutual dependency?

Post by AlexM » Wed Apr 10, 2013 12:36 pm

Yes Paolo you are right they are warnings, my mistake. It is ok to have warnings? Just ignore them? I think not normally.

Alex

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Does Logtalk support mutual dependency?

Post by Paulo Moura » Wed Apr 10, 2013 12:59 pm

In the case of these specific warnings, it's sometimes possible to rearrange source file loading order to eliminate them (of course, not when you have mutual dependencies). In general, simply ignoring warnings is a bad idea. Note, however, that there are some flags that control classes of warnings (e.g. the portability flag).
Paulo Moura
Logtalk developer

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests