Thoughts on eval()
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Dec 14, 2004
- 537 views
I've been thinking a bit about this, and I think I see a way, although there are a few implementation details that will have to be worked out. I think that I'd add a new keyword, "eval", which would be a function taking a sequence, which is just plain text source code. I can probably 'inject' this into the scanner/parser stream, and then put it into its own special SubProgram to be executed. It would probably be like having a separate TopLevel SubProgram, where you could do whatever, including defining new routines (which could be called from subsequent calls to eval). The function would return 1 if no [compile-time] errors happened, or 0 if errors did happen (like perl)--run-time errors would be handled normally. Obviously, use of eval() would break the preprocessor. Matt Lewis