Orc's value set is "open" — any value returned from a site call can be used in an Orc execution. For example, Orc programs running on a Java virtual machine (JVM) can interact with any Java object.
External values usually have types that cannot be represented using Orc's primitive types or structured types.
An import type
declaration may be used to import such a type into the Orc type system.
{- Using the Java class java.util.BitSet, construct a new instance, and then set bits 2 and 4 in the BitSet instance -} import class BitSet = "java.util.BitSet" BitSet() >b> b.set(2) >> b.set(4) >> b.toString() {- OUTPUT: "{2, 4}" -}
{- Using the Java class java.util.HashMap, construct a new instance, and then put and get some entries -} import class HashMap = "java.util.HashMap" HashMap[String, String]() >m> m.put("Mickey", "Minnie") >> m.put("Donald", "Daisy") >> m.get("Mickey") {- OUTPUT: "Minnie" -}
Related Reference Topics
Related Tutorial Sections