Re: This may be a bit of a twisted idea...
Re: This may be a bit of a twisted idea...
- Subject: Re: This may be a bit of a twisted idea...
- From: Christopher Lloyd <email@hidden>
- Date: Mon, 02 Jul 2001 16:06:30 -0400
At 12:54 AM 7/2/2001 -0700, you wrote:
So, I'm poking around in NSMethodSignature, NSInvocation, and other arcane
stuff in the Foundation kit and it occurs to me that interpreting Obj-C
method calls (a'la' Perl's "eval" operator) is quite feasible.
What I have in mind doesn't achieve the full power of the C language, but
if I were to take a page from SmallTalk and implement -ifTrue:, -ifFalse:
and loops that use NSEnumerators, then I've got Turing-complete scripting
in Obj-C, don't I?
Comments?
Entirely possible. I wrote an ObjC-subset scripting language for Yrrid's
LOF product. It has a bytecode compiler, virtual machine, can be called
from ObjC, call into ObjC and supports a decent set of ObjC and C'isms (for
a scripting language). I use NSInvocation to do the cross-talking, works
well. I don't support C structs and pointers (well, except for objects), so
that saves a lot of headaches.
Someday I hope to split it out and generalize it so it's not stuck in the
land of mainframe middleware, but right now I've got too much else to do!
Hope this helps (or provides some inspiration :),
Chris