I know XPCE is, if not deprecated, not really being worked on anymore; regardless, I’ve been trying to give it a try. I’m wondering how I can make my own code have the “optional” arguments, like new(S, path(kind := poly, points := [point(0, 0)]))
.
What do I need to do so, for example, I can do:
:- pce_begin_class(foo, device, "Foobar").
initialise(F, Baz:[int], Bar:[int]) :->
"Create a new foobar"::
format("baz = ~w, bar = ~w", [Baz, Bar]).
:- pce_end_class.
% how do I make this work?
?- new(F, foo(bar := 100)). % want: baz = @default, bar = 100
% ERROR: foo ->initialise: No argument named bar
?- new(F, foo(bar := 1, baz := 2)). % baz = 2, bar = 1