1

how to Access Parametric object from a ategory

:- category(attributes).

    :- public(info/1).
    info(Value) :- arg(1,_Array_,Value).

:- end_category.

:- object(array(_Array_),imports([attributes])).

this does not work ...

 *     Singleton variable: _Array_
sten
  • 7,028
  • 9
  • 41
  • 63

1 Answers1

1

As entity parameters are logical variables, simply share them between the object and the category:

:- category(attributes(_Array_)).

    :- public(info/1).
    info(Value) :-
        arg(1, _Array_, Value).

:- end_category.


:- object(array(_Array_),
    imports(attributes(_Array_))).

:- end_object.
Paulo Moura
  • 18,373
  • 3
  • 23
  • 33