I've got the protocol:
:- protocol(person).
:- public([name/1,
age/1]).
:- end_protocol.
For example, I've made unknown number of objects by using create_object/4, how can I get a number of them? It is not a problem to get their names by current_object/1, but I need an integer!
Assuming only objects (i.e. no categories) implement the
personprotocol, you can compute their number using e.g.Replace the call to
implements_protocol /2withconforms_to_protocol/2if you have hierarchies of objects. You can also generalize thecount/1predicate by passing the protocol as an argument.