
add_attribute(?Var, ?Attribute)

   Add dynamically an attribute to a variable

Arguments
   Var                 Any term.
   Attribute           Any term.

Type
   Term Manipulation

Description
   Adds an attribute to a variable.  The attribute name is taken as the name
   of the context module.  There must have been an attribute declaration
   (meta_attribute/2) with the same name as the context module.

   If Var is a free variable, it will be turned into an attributed variable
   with a single attribute Attribute whose name is the name of the context
   module.  If Var is already an attributed variable with other attributes,
   then the new attribute will be added to it.

   Otherwise, if the attribute slot is already occupied, or Var is already
   instantiated, then a new attributed variable with the single attribute
   Attribute is created, and subsequently unified with Var.

   Use add_attribute/3 to add an explicitly named attribute.



Modes and Determinism
   add_attribute(?, ?) is semidet

Modules
   This predicate is sensitive to its module context (tool predicate, see @/2).

Fail Conditions
   Fails if Var is not a free variable and its unification with the new attributed variable fails

Exceptions
   270 --- There is no attribute declared in the context module.

Examples
   
[eclipse 6]: meta_attribute(eclipse, []).

yes.
[eclipse 3]: add_attribute(X, a), printf("%QPMw", X).
X{suspend : _g270 , a}
X = X
yes


See Also
   meta_attribute / 2, add_attribute / 3
