On the dangers of automated refactoring

Andre Garzia andre at andregarzia.com
Wed Apr 14 05:23:18 EDT 2021

That is the main issue, the code was using the wrong hungarian-lite prefixes. You’d see something like

  on myHandler pDataA
  end myHandler

But, lo and behold, on top of the script there would be something like

  local pDataA

Now, is that an argument to a handler? a script-local? It depends! Strict compilation mode doesn’t care about variable shadowing.

> On 13 Apr 2021, at 17:48, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
> Andre Garzia wrote:
> > What I didn’t realise was that there was variable shadowing happening
> > in which handler arguments were named with the same name as script-
> > local variables, my smart replacing removed those arguments because
> > there was no need to redeclare the script-local vars. I didn’t realise
> > at that time, that those variables were real arguments being passed to
> > the handlers, they just happened to have the same name as script-local
> > vars in the same script and were in fact shadowing them.
> Is this a case where "Strict Compilation Mode" or Hungarian-lite* notation may have been useful?
> * http://www.fourthworld.com/embassy/articles/scriptstyle.html
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> Ambassador at FourthWorld.com                http://www.FourthWorld.com
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the use-livecode mailing list