COCREATOR__Obj will give the name of the locale that created the object.

so if you have a function called

new_MyClass_ =: ] conew [: coname ''"_  NB. this can be copied to all classes 
without change

then

Obj =: new_MyClass_ '' 

is equivalent to

Obj =: conew 'MyClass'

A y argument that is not '' would be passed to create_MyClass_

----- Original Message -----
From: Jon Hough <[email protected]>
To: "[email protected]" <[email protected]>
Cc: 
Sent: Thursday, April 30, 2015 8:57 PM
Subject: [Jprogramming] Datatype of an Object

It seems of I have an Object,e.g.Obj =: conew 'MyClass'
And later I want to get the type of Obj
datatype Obj
this returns "boxed", which is technically correct, but it seems datatype lacks 
the introspection to look beneath the box at the object.
So is there a way to get the type (i.e. class name if possible) of an object?
e.g. I have some variable Q (which happens to be an instance of MyClass).Is 
there a way to create a verb, getTypeOf, such that getTypeOf Q
returns 'MyClass'
I couldn't find anything in JForC on this.  At the moment I am finding it 
difficult to differentiate boxedintegers from objects.                          
 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to