Provides capability to construct an object that acts as another, even when the other object doesn't exist yet.
Until an object actually starts existing, the only thing you cannot do with a surrogate, is call it. Reading slots produces more surrogates. Can be used to resolve cyclic dependencies.
|Surrogate:New (accessor)||Creates a surrogate for function that returns the object or
|Surrogate.isSurrogate (o)||Checks, whether the given object is a Surrogate.|
- Surrogate.isSurrogate (o)
Checks, whether the given object is a Surrogate.
Even if the instance itself is an instance of Surrogate, it will return false if the object for whom the surrogate was created already exists.
- o Object to check.
trueif it is a surrogate,
falseif it is an actual object
- Surrogate:New (accessor)
Creates a surrogate for function that returns the object or
Making surrogates to surrogate is not supported.
- accessor func Function that attempts to find the object the surrogate is made for.
The created surrogate