Some methods take a lot of arguments of which you generally only want to
specify a few. A good example is the creation of a style
object. A style is an object used to control the attributes of displayed
text: font, fore- and background colour, underline, etc. Its ->
initialise
method, serving the same role the constructor
in C++, takes 7 arguments. Both calls below
create a style object representing an underlined text-fragment:
1 ?- new(X, style(@default, @default, @default, @default, @on)). 2 ?- new(X, style(underline := @on)).
The names of arguments are specified in the reference manual. For
example, the method `area->
set',
used to set one or more of the X-, Y-, H- and W-attributes of a
rectangle, has the specification given below. For each argument that is
specified as @default, the
corresponding slot will not be changed.
area->set: x=[int], y=[int], width=[int], height=[int]
The following example illustrates the usage of this method:
1 ?- new(A, area), send(A, set(y := 10, height := 50)).