Hi Jon, > In PicoLisp, it is legal to compare data items of arbitrary type. > How do ersatz compare arbitrary Java classes and objects to other > PicoLisp types? Are they less than T? Less than Numbers?
They are larger than numbers, and less than T, because they are normal anonymous symbols (like you create with 'box' or 'new'). They just happen to carry a Java object as an attachment, and when printed they don't show something as $12345 like other anonymous symbols, but $Class. Comparing them to each other follows the same mechanism as other anonymous symbols, i.e. they use the hashCode(). The C and asm versions of PicoLisp use the address for that. An interesting feature is perhaps that you can give these symbols another name (with 'name', the same way you can change the name of anonymous and transient symbols in PicoLisp). Example: : (setq S (java "java.lang.String" T "Hello world")) -> $String : (data S) -> "Hello world" : (name S "Hello World Symbol") -> "Hello World Symbol" : S -> "Hello World Symbol" : (data S) -> "Hello world" So the name is not relevant for the Java object attachment. If the symbol has no name (is anonymous), then the class of the attachment is printed. Otherwise, the normal name is printed, but the symbol doesn't lose its "nature" as a Java object. Cheers, - Alex -- UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe
