CompuServe Thread

#Transient Autolisp?

2 messages in this thread
#21982From: LEN MILLERApr 19, 1988 6:16 AM
I've been avoiding the defun convention lately in several of my lisp programs. That is, (defun xxxx () ;working code goes here );end defun By avoiding the top and bottom line as the working code is "loaded", I perceive that the function is transient, doing its job and leaving behind in memory only the global symbols which might have been changed or initialized. Is this perception correct? Or might it haunt me later with some unformseen problems? One reason, for example, is a program like my SETSUP.LSP. It's nearly 4000 bytes long. Once I'm done with it at the start of an editing session it normally won't be used again, so why allow it to stick around? I have several other programs, also large and loaded in transient fashion for the same reason. I understand by operating this way there are at least two disadvantages. Symbols cannot be defined as LOCAL. And each time the program is executed it must be loaded from disk. Am I missing something else? Am I really saving anything? Are there some other disadvantages?
#21989From: Training [ADESK]Apr 19, 1988 11:20 AM
Len — You've called it pretty close. When you LOAD a file, AutoLISP redirects standard input from the keyboard to the file, so for all intents and purposes, LOADing a file works the same as if you had typed in the expressions at the keyboard. Did you know that there is a way to create a function that will allow you to create local variables and will vaporize after execution? Look up the definition of the function LAMBDA in your AutoLISP Programmer's Reference, and take a close look at the file SETUP.LSP, which was included with your AutoCAD release disks. — Brad ..