[comp.lang.icon] The Final Clause

TENAGLIA@mis.mcw.edu (Chris Tenaglia - 257-8765) (11/29/90)

Regarding : The Final Clause

I've seen a lot of interesting replies on this problem. Some say it's not
possible because it's 'decidable'. Someone else mentioned the 'halting
problem', which I assume refers to Turing machines. How does a procedure
'know' when it's finally called? Also the example I furnished wasn't very
good, but I can't seem to think of another at the moment. I didn't think
it would have been such a big deal. After all, how does program know when
it's reached the end of file or pipe? (The operating system tells it).
I also thought that since Icon is a virtual machine, that its extensibility
would allow something like the Variant Translator or Personal Interpreter
to handle it.

Practically, though, the method I envisioned was that Icon would do a silent
run, recording activity to a journal (much like MEMMON). Upon exit, the final
clause(s) would be inserted into the journal stream, and then the whole mess
flushed (kind of like a database commit).

I thought about that a bit, and I guessed it would gobble tons of memory/disk
and cause everything to run slow. I also dreaded permutations with 'final's
getting tied up in recursive infinite loops. I also considered limiting it
to one 'final' per program, or allowing only in main(), but that really did
not seem too useful.

I guess the best approach is to use a procedure final() called near the end
of main() using passed or global variables. Thanx for all the ideas.

Chris Tenaglia (System Manager) | Medical College of Wisconsin
8701 W. Watertown Plank Rd.     | Milwaukee, WI 53226
(414)257-8765                   | tenaglia@mis.mcw.edu, mcwmis!tenaglia