public final class SLType extends Object implements com.oracle.truffle.api.interop.TruffleObject
The isInstance type checks are declared using an functional interface and are expressed using the interoperability libraries. The advantage of this is type checks automatically work for foreign values or primitive values like byte or short.
The class implements the interop contracts for InteropLibrary.isMetaObject(Object) and
InteropLibrary.isMetaInstance(Object, Object). The latter allows other languages and
tools to perform type checks using types of simple language.
In order to assign types to guest language values, SL values implement
InteropLibrary.getMetaObject(Object). The interop contracts for primitive values cannot
be overriden, so in order to assign meta-objects to primitive values, the primitive values are
assigned using language views. See SLLanguage.getLanguageView(com.oracle.truffle.sl.runtime.SLContext, java.lang.Object).
| Modifier and Type | Field and Description |
|---|---|
static SLType |
BOOLEAN |
static SLType |
FUNCTION |
static SLType |
NULL |
static SLType |
NUMBER |
static SLType |
OBJECT |
static SLType[] |
PRECEDENCE |
static SLType |
STRING |
| Modifier and Type | Method and Description |
|---|---|
Object |
getName() |
boolean |
isInstance(Object value,
com.oracle.truffle.api.interop.InteropLibrary interop)
Checks whether this type is of a certain instance.
|
String |
toString() |
public static final SLType NUMBER
public static final SLType NULL
public static final SLType STRING
public static final SLType BOOLEAN
public static final SLType OBJECT
public static final SLType FUNCTION
public static final SLType[] PRECEDENCE