Garbage and macros
- Posted by Daniel Johnson <Lmailles at AOL.COM> Feb 13, 1998
- 637 views
I heard mention of garbage collection recently. Does Euphoria have a fully automatic garbage collection system like Java ? If I read a whole file into a sequence, should I null the sequence after I have finished ? I had an idea yesterday, which may not be original, or may even be old stock. If it is, use whatever form of DELETE button you have available. In some assemblers you have the option of macros. These are like subroutines except that they are inserted into the code at compile-time ie they run inline. This of course saves the time of a subroutine call, and also saves repeating code. This could be extremely handy in Euphoria, for example if you use the same short piece of code several times in a prog, and call it a large number of times eg macro stuff(integer a) return power(a+1,2)-3 end macro sequence temp temp={} for a=1 to 1000000 temp=temp&stuff(a) end for The other *real* advantage of macros is that they could allow conditional compilation. if condition then macro stuff(integer a) return power(a+1,2)-3 end macro else macro stuff(integer a) return a --This compiles to nothing end macro end if Then when you run your for-loop, you have saved 1000000 wasted function calls. Just an idea. Daniel Johnson Les Mailles Telesoft