I was poking around some of Core and Object using "getSlot("method name") to see how some foundational methods were implemented. I was curious about how the if method was written and tried
Io> Object getSlot("if")
==> Object_if()
Io> Object getSlot("Object_if()")
==> nil
Neither of these were informative. Is there a way to reflect/inspect/print this (and other Object_keywordishword() words)?
I gave a talk to a group in New York a while back which included a cleanroom implementation of if if you're curious about the mechanics. You can see it here.
More directly, when you see:
==> Object_if()
In the REPL, what that's telling you is that if is a symbol bound to the object Object which is implemented in C. That is to say, the "method" is actually a CFunction object, and not a Block object. Only Block objects show their source in the REPL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With