Package gnu.mapping
Interface Lazy<T>
-
public interface Lazy<T>
A lazy value is one that may be calculated on demand. The primary implementation class isPromise
, butFuture
also implementsLazy
. Primitive operations (such as arithmetic) require non-lazy (or "eager") values; in Kawa these are automatically evaluated ("forced") usingPromise.force(java.lang.Object)
or equivalent.In Kawa all objects are considered eager (non-lazy) unless the object's class implements
Lazy
, though note that an eager value may contain lazy components (for example an eager vector of lazy values). Note that the compiler assumes thatPromise.force(java.lang.Object)
is a no-op and does not need to be emitted unless the type of the value implementsLazy
, or the class isObject
. (SeeLazyType.maybeLazy(gnu.bytecode.Type)
.)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
getValue()
Return the actual value.
-
-
-
Method Detail
-
getValue
T getValue()
Return the actual value. Note thatgetValue()
may returnthis
, if this object isn't actually lazy. It may also return another lazy value. Normally you should usePromise.force{val}
to extra a non-lazy (eager) value.
-
-