Instance creations are written using NEW(path|typ|"C"):
NEW(sym.T) // new T
NEW("C") // new C
NEW(REF("B") DOT "C") // new B.C
Optionally, arguments may be passed into the constructor using NEW(path|typ|"C", arg, ...):
NEW("C", LIT(0), LIT(1)) // new C(0, 1)
Anonymous classes are created by passing ANONDEF(parent|"C", ...) into NEW(...):
NEW(ANONDEF() := BLOCK(
DEF("name") := LIT("Robert")
))
NEW(ANONDEF("C") := BLOCK(
DEF("name") := LIT("Robert")
))
NEW(ANONDEF("C") withEarlyDefs(
VAL("name") := LIT("Robert")
))
These examples print as:
new {
def name = "Robert"
}
new C {
def name = "Robert"
}
new {
val name = "Robert"
} with C