Re: speaking of control structures...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 06 May 2009 08:54:14 -0400, fsb@xxxxxxxxxx (Tom Worster) wrote:

.......
>clancy, i can't argue with you. my desired usage of break is really just a
>cover-up for a goto. i know.
>
>it makes no logical sense but i think i'd sooner adopt oop than gotos. my
>mom taught me to program back in the late 70s and early 80s. she was an old
>hand. when FORTRAN 4 came out she thought it was the bees knees. when Z80
>micros with MS-BASIC came out, she thought they were cute. when turbo pascal
>came out on CP/M, she was impressed and taught me to quit using gotos.
>
>so while it makes no logical sense, perhaps you can see that it makes
>emotional sense.
>

I can understand your reluctance to disregard your mother's advice, but unfortunately she
had been brainwashed to accept the dogma of the day. I could never understand the hysteria
relating to GOTO. Certainly it could be abused, as I knew to my cost, but it is clear and
explicit, whereas both break and exception are disguised GOTO's with ill-defined targets.

I started programming in 1967, in Fortran. There were only the most basic computer
manuals, and CSIRO (for whom I worked) had a little computer (a CDC3200, with 32K of 24
bit words, and costing only $500,000) in each capital city, and a big computer (a CDC3600,
with 64K of 48 bit words, and costing $2 million) in Canberra. Our local computer was at
Clayton, and I worked at Highett, so a courier collected our punch cards twice a day and
took them to the local computer, then brought back the results of the previous run, giving
effectively one and a half runs a day.

When I got ambitious, and needed to use the big computer, my cards were put on to mag tape
at Clayton, and flown to Canberra, where they were run through the 3600 overnight, and the
results written back to mag tape. Next morning the tapes were flown back to Melbourne,
driven to Clayton, run through the 3200 to produce listings, and these were then delivered
back to Highett. The flights were often delayed by fog in Canberra, and on average we got
three runs a week.

Programming was in its infancy, and the idea of using a stack to handle subroutines had
not been introduced (at least by CDC). The Fortran provided an assigned GOTO, which really
was the perfect instruction for writing 'write only' code. It also permitted you to jump
indiscriminately into, or out of, loops and subroutines, and it was probably abuse of
these options which gave the GOTO its bad name. 

I was developing a program for analysing linear electronic circuits, and effectively
developed my own interpreted language. The program was very simple; it consisted of a loop
containing three assigned GOTO's:

start: 	assign begin to switch_one
	assign 	........

next:	read the next character
	if it's a number, GOTO switch_one
	if it's a punctuation mark, GOTO switch_two
	GOTO switch_three

begin:
	.....
	GOTO next
end:

I left CSIRO in 1973, and did not have access to a big computer until about 1983. By this
time the assigned GOTO had long since vanished, and I had great difficulty understanding
my original logic, until I unrolled the inner loop into a logical progression through the
possible inputs.

For the next 20 years most of my programming was in 8x86 MASM. This also had the GOTO, and
I was able to write extremely complex programs, despite its inherent verbosity, by
developing subroutines to handle all the basic procedures, and using GOTO's to define the
control structure.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux