java.lang.Object | +--org.erights.e.elib.prim.E
Safe: This class is most of the normal application programmer's API to the ELib functionality. In particular, the send methods below are what E's "<-" turn into.
NOTE! All the methods of this class trust their callers to 1) only provide interned strings as verbs, and 2) not modify an args array after passing it in. Btw, all source code literal strings are automatically intern()ed. ELib itself will never modify a passed-in args array.
This class is not intended to be used directly from E-language programs. Rather, the name "E" in the safe scope contains a thin wrapper for this class for the E language programmer to use instead.
private static boolean
Backtracing
private static void
abbrev(StringBuffer buf,
String str,
int[] budget)
static Object
as(Object specimen,
Class targType)
static RuntimeException
backtrace(Throwable ex,
Object rec,
String verb,
Object[] args)
static Object
call(Object rec,
String verb,
Object arg1,
Object arg2)
static Object
call(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3)
static Object
call(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
static Object
callAll(Object rec,
String verb,
Object[] args)
static void
require(boolean cond,
Object problem)
static Ref
send(Object rec,
String verb,
Object arg1,
Object arg2)
static Ref
send(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3)
static Ref
send(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
static Throwable
sendAllOnly(Object rec,
String verb,
Object[] args)
static Throwable
sendOnly(Object rec,
String verb,
Object arg1)
static Throwable
sendOnly(Object rec,
String verb,
Object arg1,
Object arg2)
static Throwable
sendOnly(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3)
static Throwable
sendOnly(Object rec,
String verb,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
static Twine
toTwine(Object obj)
public static final Object[] NO_ARGS
private static boolean Backtracing
This is a rare case of something I don't know how to do as well in a pure capability pattern.
private E()
public static Object call(Object rec, String verb)
callAll(Object, String, Object[])public static Object call(Object rec, String verb, Object arg1)
callAll(Object, String, Object[])public static Object call(Object rec, String verb, Object arg1, Object arg2)
callAll(Object, String, Object[])public static Object call(Object rec, String verb, Object arg1, Object arg2, Object arg3)
callAll(Object, String, Object[])public static Object call(Object rec, String verb, Object arg1, Object arg2, Object arg3, Object arg4)
callAll(Object, String, Object[])public static Object callAll(Object rec, String verb, Object[] args)
private static void abbrev(StringBuffer buf, String str, int[] budget)
public static RuntimeException backtrace(Throwable ex, Object rec, String verb, Object[] args)
public static Ref send(Object rec, String verb)
sendAll(Object, String, Object[])public static Ref send(Object rec, String verb, Object arg1)
sendAll(Object, String, Object[])public static Ref send(Object rec, String verb, Object arg1, Object arg2)
sendAll(Object, String, Object[])public static Ref send(Object rec, String verb, Object arg1, Object arg2, Object arg3)
sendAll(Object, String, Object[])public static Ref send(Object rec, String verb, Object arg1, Object arg2, Object arg3, Object arg4)
sendAll(Object, String, Object[])public static Ref sendAll(Object rec, String verb, Object[] args)
Rather than providing an explicit Resolver as input argument, this method returns a promise that represents the outcome. When the actual outcome is determined, the returned reference will reflect that outcome.
This should only synchronously throw an exception if invoked while there's no current Vat.
public static Throwable sendOnly(Object rec, String verb)
public static Throwable sendOnly(Object rec, String verb, Object arg1)
public static Throwable sendOnly(Object rec, String verb, Object arg1, Object arg2)
public static Throwable sendOnly(Object rec, String verb, Object arg1, Object arg2, Object arg3)
public static Throwable sendOnly(Object rec, String verb, Object arg1, Object arg2, Object arg3, Object arg4)
public static Throwable sendAllOnly(Object rec, String verb, Object[] args)
public static String toString(Object obj)
public static Twine toTwine(Object obj)
E programmers should generally call "E.toTwine(obj)", rather than "obj.toString()". This applies both to E language programmers and to ELib programmers. However, E programmers should not generally call E.toTwine(obj) from within __printOn(TextWriter) methods, as that will circumvent the cycle-breaking logic in TextWriter. Instead, you should usually call a TextWriter.*print*(obj) method, as it will check for a cycle before calling __printOn(TextWriter) on its argument.
public static Twine toQuote(Object obj)
org.erights.e.elib.oldeio.TextWriter#quotepublic static Object as(Object specimen, Class targType)
Given that specimen is NEAR, when targType isPrimitive(), then
E.as(specimen, targType)is like
targType.coerce(specimen, null)Otherwise
E.as(specimen, targType)is like
nullOk(targType).coerce(specimen, null)If specimen is not near and targType isn't a rubber stamping interface, then either of the above coerce calls will fail, but E.as will succeed if the specimen is a Java-instanceof the targType.
public static Object as(Object specimen, Class targType, OneArgFunc optEjector)
public static boolean asBoolean(Object specimen)
public static int asInt(Object specimen)
public static double asFloat64(Object specimen)
public static char asChar(Object specimen)
public static RuntimeException asRTE(Object problem)
public static void require(boolean cond)
public static void require(boolean cond, Object problem)
If problem coerces to a Thunk, then reassign problem to be the result of calling this thunk with 'run()'. Then, in either case, coerce this problem to a RuntimeException and throw it.
This is used by the implementation of the 'require' function in the E language's universal scope.