Exploring the machine "state"?


(Jean Christophe Helary) #1

I went to sleep last night with the idea that Apple Events (or whatever is behind the things we access with AppleScript) could be construed as something very similar to the Lisp virtual machine that emacs is.

For those who don’t know (and those who know can correct me if my understanding is wrong) emacs was designed not so much as a text editor, but as a lisp virtual machine at the time when lisp was very hot and Lisp machines makers almost bled the MIT to death by hiring all the specialists and at the same time closed the technology that the MIT had developed. Stallman at MIT tried to compromise until he understood that the only solution for the technology to survive was to create a portable lisp machine and distribute it for free. That’s how emacs and the free software movement was born.

So, emacs gives you access to everything in itself and running lisp code in it modifies the state of the lisp machine and also creates “side effects” like printing a character to the screen, etc.

The interesting thing with emacs (lisp) is that you don’t need to run a whole “page” of code to have your result, you can run single expressions in that page, see how that works, run other expressions, test, etc. That allows for exploratory programming in various machine states.

So I was wondering if something similar was possible with AppleScript and/or SD. I was under the impression from reading the Smile documentation that you could achieve something similar to that but I can’t seem to make Smile run on my machine.

I was reading Learn AppleScript & AppleScript the Definitive Guide last night (excellent bed time readings if you want to have weird dreams) and since modifying a script means reinitializing it’s state, that it does not seem possible to just add a line, run it, see how it goes, modify it, etc… But Smile does it, right?

Can something like this be implemented in SD ?


(Ed Stockly) #2

I think so (if I understand what you’re asking for) Look in SD Help: Script Debugger Help > Develop > Debug > Expressions

That show you how to reveal and use the Expressions pane. Basically if you’re running a script and it’s paused you can enter an AppleScript expression in the Expression field and see the result in the Value field.


(Jean Christophe Helary) #3

Ed, thank you for this :slight_smile: I’ll give it a try.