From starred@tiscalinet.it Tue Oct  2 14:41:11 2001
Received: from mailrelay1.inwind.it (mailrelay1.inwind.it [212.141.54.101])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f92CfAv02601
	for <prolog@swi.psy.uva.nl>; Tue, 2 Oct 2001 14:41:10 +0200 (MET DST)
Received: from tiscalinet.it (62.98.196.157) by mailrelay1.inwind.it (5.5.029)
        id 3BA9F53E00224FFA for prolog@swi.psy.uva.nl; Tue, 2 Oct 2001 14:40:48 +0200
X-Mozilla-Status: 0801
Message-ID: <3BB9B22D.5090104@tiscalinet.it>
Date: Tue, 02 Oct 2001 14:25:17 +0200
From: Armando Stellato <starred@tiscalinet.it>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1
X-Accept-Language: en-us
MIME-Version: 1.0
To: SWI Mailing List <prolog@swi.psy.uva.nl>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Subject: [SWIPL] module coerency problem

Hi, I've a problem with modules:
I'm building an agent environment.
I'm making great use of modules, so to create various layers and be able 
to work on each of them without modify the code in the substrates.

I've a module named agents who use_module various modules, every agent 
written uses only imported methods (predicates) from module:agents, then 
'agents' calls methods from its various submodules who are visible only 
by himself.

The problem is:
One of the submodules is agents_io that has a method called: handle_msg/2.
I would like to expand agents_io with conditional consulting/use_module 
with new instances of handle_msg/2.
I'll make an example:
in 'agents_io' i've:
handle_msg(AgentId,txt_msg(TXT)),
handle_msg(AgentId,disconnect).

I've build a module called 'coordinator_agent' that is consulted only if 
the agent using module agent is of type:coordinator.
This module is consulted by "agents_io" and should give some more 
handle_msg methods.
Exampe:
exp_handle_msg(AgentId,agent_declare(ROLE,ONTOLOGY,LANGUAGE))

The problem is:
if i make agents_io consult 'coordinator_agent', the compiler says me 
that i've redefined handle_msg/2, so it doesn't uses original handle:msg 
from agents_io
if i make agents_io use_module coordinator_agent (rewritten as a 
module), the compiler says me that predicate names clash (cause 
handle_msg is already defined in agents_io).

Is there really no way to add some more handle_msg predicates to 
agents_io, without modifying everytime the code in the module agents_io???
I don't want to go around the problem using another name for the 
predicates handle_msg in coordinator_agent and invoke them if handle_msg 
fails on agents_io. This is a solution but i don't like it, it is "dirty".
any other solution?

Thanks in advance

Armando Stellato


