src/swipl-devel/packages/xpce/man/refmanual/md/var.md

class var {#class-var}

Class var describes a global variable. It is a subclass of class function, which implies that a variable is expanded to its value for all methods that do not explicitly accept type function or var.

PCE global variables have global existence, but may have local binding. The most well known var objects are @receiver, @event and @arg1 ... @arg10.

A variable has a <-_type to define legal values, a <-_name to identify them (named var objects are used by class handle and class spatial) and a <-_value. Note that these names start with an underscore. Thus,

get(Var, '_name', Name)

yields the name of the var object, while

get(Var, name, Name)

yields the name of the <-_value of the var object.

Values are assigned using ->assign. Class assign defines an executable object to assign variables.

Using var objects explicitly {#class-var-using-var-objects-explicitly}

There are some common ways to exploit var objects in applications:

@see class assign

Instance variables {#class-var-instvars}

Send methods {#class-var-send}

Get methods {#class-var-get}



Try the rswipl package in your browser

Any scripts or data that you put into this service are public.

rswipl documentation built on June 16, 2026, 5:07 p.m.