Value Properties

We can associate properties with values. Normally these are the signature and document strings for functions and a name for closures.

The properties of a value are a keyword table. You can then reference or set a property within that table.

Note

Property tables are not automatically created for values.

function %properties o [default]

return the properties table for o

Param o:

value to get properties for

Type o:

any non-#n

Param default:

value to return if no properties exist

Type default:

any, optional

Return:

properties table

Rtype:

keyword table

Raise ^rt-parameter-nil-error:

Raise ^rt-hash-key-not-found-error:

function %set-properties! o properties

set the properties table for o to properties

Param o:

value to set properties for

Type o:

any non-#n

Param properties:

properties table

Type properties:

keyword table

Return:

#<unspec>

Raise ^rt-parameter-nil-error:

See also

make-keyword-table for a means to create a proprty table

function %property o kw [default]

return the property kw for o

Param o:

value to get properties for

Type o:

any non-#n

Param kw:

property

Type kw:

keyword

Param default:

value to return if no such property exists

Type default:

any, optional

Return:

property value

Rtype:

any

Raise ^rt-parameter-nil-error:

Raise ^rt-hash-key-not-found-error:

function %set-property! o kw v

set the property kw for o to v

Param o:

value to set properties for

Type o:

non-#n

Param kw:

property

Type kw:

keyword

Param v:

value

Type v:

any

Return:

#<unspec>

Raise ^rt-parameter-nil-error:

Last built at 2024-12-21T07:10:39Z+0000 from 62cca4c (dev) for Idio 0.3.b.6