eval() considered dodgy - Re: Self modifying code, lambda calculus - Re: ENIAC programming
toby at telegraphics.com.au
Sat Sep 19 12:45:02 CDT 2015
On 2015-09-19 1:15 PM, Liam Proven wrote:
> On 19 September 2015 at 17:02, Rod Smallwood
> <rodsmallwood52 at btinternet.com> wrote:
>> Its a while back but I seem to remember in BASIC you replaced a set of line
>> numbers with another of the same range but different code.
> Blimey, I've never seen that.
> I do remember that ZX BASIC had a cool-but-dangerous feature: you
> could get it to evaluate an arbitrary string as if it were an
> expression. This meant you could do cool things in BASIC programs --
> enter formulae such as "2*4+3.5" when the program wanted a numeric
> value, for instance.
> Then a friend showed me that you could also access the program's own
> variables. If the program had variables called a, b & c, you could
> also enter "a*b+c" and it would use the values.
> Which meant that if it /didn't/ have such variables, the program would
> crash out with an "unknown variable name" error... a sort of early
Thank God nobody would build such a thing into a modern language,
especially not the one that runs in almost every browser...
More information about the cctalk