[NTLK] Need pointers for adding Apply()/Perform()/PerformIfDefined()/etc. to NEWT/0

Morgan Aldridge morgant at makkintosshu.com
Thu Jul 26 08:10:58 EDT 2012

On Tue, Jul 24, 2012 at 9:30 PM, Morgan Aldridge
<morgant at makkintosshu.com> wrote:
> My initial implementation of Perform(), internally implemented as
> NcPerform() (see https://gist.github.com/3173823), currently throws an
> exception when trying to convert the slot name to a symbol. I'm
> getting closer, but have opened up an issue on the NEWT/0 project on
> GitHub, in case anyone can chime in:
> https://github.com/gnue/NEWT0/issues/2

Makoto Nukui has been assisting me with this and the implementation is
almost as straightforward as I initially hoped. I have Perform()
implemented and will be getting the others done soon (whenever I have
a few mins). That said, I missed one important part of the note on
it's usage: Perform() and its variants require the message to be a
symbol (either a constant or a named constant). Unfortunately, that
means it's not what I was originally looking for, but obviously well
worth implementing these global functions in NEWT/0.

So, back to my original problem for a sec (if anyone is bothering to
read this thread), do any of the few NewtonScript developers know of a
way to send a message to a frame by method name, not using a symbol?
For example, say I have a frame that contains a method:

    someFrame := { SomeMethod: func() begin
        end };

Normally this would be called as follows:


Alternatively, you can use Perform():

    Perform(someFrame, 'SomeMethod, nil);

But what if I don't know the name of the method I until runtime and
instead had a variable containing the slot/method name and wanted to
call it by that:

    someFrame := { SomeMethod: func() begin
        end };
    methodName := "SomeMethod";

Can I do something like the following (I've seen this for regular slot
names, but not for message passing)?


Or, is there some way to programmatically convert a string to a
symbol/constant in NewtonScript?

Thanks in advance,


More information about the NewtonTalk mailing list