Next: Variables

Prev: Buffers

Frobs

A frob is a dictionary or list (its representation) associated with a dbref (its class). Frobs represent a kind of lightweight object, with less overhead than real objects. The encapsulation around frobs is not as strong as the encapsulation around real objects, and in some respects frobs are not as convenient to work with as real objects. In general, objects should be used for long-lasting, complicated, changing entities, while frobs should be used for small pieces of data.

Frob construction expressions have the following syntax:

<class, representation>
The result of a frob construction expression is a frob of class class, which must be a dbref, with a representation representation, which must be a list or dictionary. In general, you should only use the frob construction expression to construct frobs of class this(), but this is not enforced. The following are valid frob construction expressions:

<#76, #[['type, 'true]]>
<#89, ["You cannot go that way."]>
Apart from operations which apply to all data types, the only operations supported on frobs are message-passing and the class() function. When you send a message to a frob, the interpreter treats it as a message to the frob's class, with the frob's representation inserted as the first argument. The class() function returns the class of a frob.