Le 23 juin 08 à 17:49, Peter A Passaro a écrit :
> Hi All,
>
> I just realized my code suggestion in the last post about single
> word commands won't work well for F-Script, as the object browser
> and other F-Script components are using the -description method of
> objects to query their name or class. This causes the object to
> execute itself every time I open a brower. Back to the drawing
> board...
>
> I'll dig into the F-Script framework to see how Philippe is using
> objects and see if I can figure out a way to do this. This may be
> too much of an ask within the bounds of the F-Script system though.
> What I was going for was something along the lines of an object that
> self executes, like a Block that doesn't require the -value method
> to execute, but this probably breaks the style metaphor of F-Script.
> What I will probably do is just have an object in the interpreter
> named "COM" that has as its methods all the relevant system commands
> for my app, i.e. for a new document: "COM newDoc".
>
> Philippe, am I correct in thinking that their are no one word
> commands (other than object descriptions) in F-Script?
Correct.
The strategy of defining a "COM" object will work fine.
You can also easily add support single word command in the interpreter
view by modifying the "command:from:" method in FSInterpreterView to
test for the class of the result and, if it is of a given class (e.g.
NEAFSCommand), ask it to execute its command. Note that this approach
will only work for single word command entered interactively (i.e.,
not inside scripts). if you want to support single word commands
inside scripts, you'll have to digg deeper in the run-time, but it
should still be fairly easy. The loop inside the "STATEMENT_LIST: "
case of the execute_rec() function in FSExecEngine.m is probably the
place where you'll want to insert the code supporting single word
commands.
Philippe
|