On Sat, Sep 12, 2015 at 2:07 AM, Graham Samuel <livf...@mac.com> wrote:

> The classic exposition of the ‘go to’ problem AFAICR is Edgar Dijkstra’s
> 1968 paper "Go To Statement Considered Harmful”. Google will take you there
> if you’re interested. Not everyone agreed with Dijkstra even at the time,
> but he was certainly on to something


And in time this morphed into the notion that goto should never be used . .
.

When I was writing the program for my dissertation, I eventually realized
that I was updating to identical blocks of code solely to avoid a goto.  I
put it in, and life became much easier (now, that was an exotic case, where
I had to escape a nested control structure or some such; I forget the
details.  The routine could be entered from multiple states, requiring
different startup prep)

The missing control structure that is killing me in livecode is something
like

repeat for some reason or another :georgeCheck

...
exit repeat georgeCheck


which would allow leaving an outer repeat from within an inner repeat.


As far as transfer of control, even into the 90s it could be "expensive".
To call a function or subroutine, there were variables and registers to be
dumped in some manner, possibly by pushing to the stack, new ones to be
loaded and initialized, and then the restoration of the original state on
return.

I wrote a model in smalltalk in 95 or 96, with "proper" message passing and
functions.  It was insanely slow.

I rewrote, pretty much line for line, in Fortran with arrays and no effort
to optimize, and got a 45,000:1 speedup . . .

Also, note that at least older Fortran had two types of functions, one with
code that returned a value, and the other was a an inline math expression,
which wouldn't require a transfer of control.

It's probably part of my 8 bit hangover, but I still hesitate every
function call or subroutine aI write, wondering how expensive it will be .
. .

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to