|
From: | Paulo Moura |
Subject: | Re: foreign predicate not working (one more observation) |
Date: | Mon, 19 Jul 2004 15:49:50 +0100 |
On 19/jul/2004, at 15:25, Saurabh Bhatla wrote:
:- foreign(get_event_ob(+string,-string)). :-object(receiver). :-public(receive/1). :-public(validate/1). :-public(get_event_ob/2). receive(Event). validate(Event):- self(Self), Self::get_event_ob(Event,Object), write(Object), write('<-object found for event->'), write(Event),nl. validate(Event):- write('No object found for event->'), write(Event),nl. :-end_object.
Note that, because get_event_ob/2 is _declared_ as a _public predicate_ inside the object receiver, calls such as the following one:
Self::get_event_ob(Event,Object),
always fail without error as get_event_ob/2 is within the scope of Self. Being a static predicate with no clauses, means that the calls to it always fail (you could be declaring a predicate which would only be defined in descendant objects).
Cheers, Paulo ----------------------------------------------------------- Paulo Jorge Lopes de Moura Dep. of Informatics Office 4.3 Ext. 3257 University of Beira Interior Phone: +351 275319700 6201-001 Covilhã Fax: +351 275319891 Portugal <mailto:address@hidden> <http://www.di.ubi.pt/~pmoura> <http://www.logtalk.org> -----------------------------------------------------------
[Prev in Thread] | Current Thread | [Next in Thread] |