Package gnu.mapping

Interface Lazy<T>

All Known Implementing Classes:
Future, LProcess, Promise

public interface Lazy<T>
A lazy value is one that may be calculated on demand. The primary implementation class is Promise, but Future also implements Lazy. Primitive operations (such as arithmetic) require non-lazy (or "eager") values; in Kawa these are automatically evaluated ("forced") using Promise.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 that Promise.force(java.lang.Object) is a no-op and does not need to be emitted unless the type of the value implements Lazy, or the class is Object. (See LazyType.maybeLazy(gnu.bytecode.Type).)

  • Method Summary

    Modifier and Type
    Method
    Description
    Return the actual value.
  • Method Details

    • getValue

      T getValue()
      Return the actual value. Note that getValue() may return this, if this object isn't actually lazy. It may also return another lazy value. Normally you should use Promise.force{val} to extra a non-lazy (eager) value.