persistable sclass PersistableOKOrError implements IF0 {
A value;
gettable PersistableThrowable error;
*() {}
*(A *value) {}
*(bool dummy, PersistableThrowable *error) { assertNotNull(error); }
bool ok aka isOK() { ret error == null; }
toString {
ret ok()
? /*"OK: " +*/ str(value)
: "Error: " + str(error);
}
public A get() { ret !ok() ? null : value; }
public A getMandatory() { if (!ok()) throw error.asRuntimeException(); ret value; }
static PersistableOKOrError ok(A a) { ret new PersistableOKOrError(a); }
static PersistableOKOrError error(PersistableThrowable error) { ret new PersistableOKOrError(false, error); }
}