Here are two fun weird things I like about SBASIC. Maybe others on this list
will add their quirks too...?

1. the "MISTake" keyword.

If you load a BASIC program that contains an error that would normally
provoke a "bad line" response, it inserts the word "MISTake", to indicate
that the line will generate an error. The fun thing is, MISTake is a keyword
you can enter yourself. It's like REMark, but doesn't prevent parsing of the
following text.

2. Re-entrancy limits.

Take the following contrived example of bad coding:

100 count=0 : mode 4
110 do_it
120:
130 DEFine PROCedure do_it
140 count = count + 1
150 PRINT count : PRINT #2, FREE_MEM
160 do_it
170 END DEFine do_it

In this example, the procedure gets called from within the procedure. This
creates a loop, d'uh! Every 20 or so cycles, the return stack fills, and
another 512 bytes is reserved. As the recursion goes deeper, memory starts
to run low. It takes about 20 loops to use 512 bytes, so it takes around
25,060 loops to use up all the free RAM on a 640K QL.

The fun part is, when the program finishes consuming all the memory,
FREE_MEM actually goes negative, to -512, and the program manages 20 more
loops before generating an out of memory error.

Fun times!

Anyone got any other little oddities or observations about this quirky
little OS that could?

Dave
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to