ID:137595
 
I encountered a rather nasty problem with my library. Say, for example, I have the following proc:

proc/my_proc(atom/movable/O)


Now, in that proc, let's see what happens if O is not an actual object, but rather a type.

mob/verb/whatever()
my_proc(/obj/my_object)

No big deal... it is a simple matter to go into my_proc()'s code and enter:

if(!isloc(O)) O = new O()


But, now envision this with a datum:

proc/my_proc(/my_datum/O)

To determine if a reference is a type, one uses the handy istype() proc.

if(istype(O)) O = new O()


But that line is where it breaks. Unfortunately, istype() will return true whether it is a datum type or an actual instance of a datum.

...Which causes rather serious problems with the way my library is set up.

Thus, I'd like to ask for an isref() proc. Is this manageable?
Woah, your lib must get really into stuff...

isref()...
You could just ask initialize a variable inside the object, like valid or something which is set at the creation of the object, and then have my_proc run a check on that, but that is really annoying
In response to Cybergen
Cybergen wrote:
You could just ask initialize a variable inside the object, like valid or something which is set at the creation of the object, and then have my_proc run a check on that, but that is really annoying

Unfortunately, I couldn't... it would give a 'bad var' runtime error, if it was not an actual object but just a type.