undeclared variables getting through in Strict Compilation mode

Dr. Hawkins dochawk at gmail.com
Tue Feb 17 02:48:44 CET 2015


On Mon, Feb 16, 2015 at 2:03 PM, J. Landman Gay <jacque at hyperactivesw.com>
wrote:

> I'm still not sure what you saw. Maybe if you can post the handler and
> describe what happened again we will spot something.


It used to be

on prePreOpenStack
   local prefsDir, prefsFilNam, newPrefsDb, prTabNams
   local dcmd, theData, vtb

...
   put "SELECT pref, pval FROM prefs" into dcmd
   put revDataFromQuery(tab,vtb,prefsDb,dcmd) into prAry
   split prAry by vtb and tab


It threw no error loading prAry, and it turned into the correct array.

Single step into the calling handler, and prAry and the global prAry was
gone.

Strict compilation was set in the preferences; I checked.  I can't use
explicit variables without a significant code rewrite, as "long name"
produces a result that is incompatible with, well, livecode.

I added "global prAry" after the local declarations, and everything worked
fine (which also shows that prAry wasn't declared somewhere else [unless
there is something even *worse* going on! :)])

It was similar in the other instance (actually, I think it was allowing
prefsDb to be set localy even though it wasn't declared)


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462


More information about the use-livecode mailing list