Class SLNull

java.lang.Object
com.oracle.truffle.sl.runtime.SLNull
All Implemented Interfaces:
com.oracle.truffle.api.interop.TruffleObject

public final class SLNull extends Object implements com.oracle.truffle.api.interop.TruffleObject
The SL type for a null (i.e., undefined) value. In Truffle, it is generally discouraged to use the Java null value to represent the guest language null value. It is not possible to specialize on Java null (since you cannot ask it for the Java class), and there is always the danger of a spurious NullPointerException. Representing the guest language null as a singleton, as in this class, is the recommended practice.
  • Field Details

    • SINGLETON

      public static final SLNull SINGLETON
      The canonical value to represent null in SL.
  • Method Details

    • toString

      public String toString()
      This method is, e.g., called when using the null value in a string concatenation. So changing it has an effect on SL programs.
      Overrides:
      toString in class Object