Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #42597
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: [Poll] Computing favorities |
| Date | 2015-10-12 09:20 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <mvfu1d$ms0$1@dont-email.me> (permalink) |
| References | (2 earlier) <d7s2ffFhvhhU16@mid.individual.net> <mvbae1$ioq$2@dont-email.me> <mvbi7g$h3u$1@dont-email.me> <ei7j1bt0g8l2c001c282lvecvahekchmld@4ax.com> <ed805464-efae-4aad-870c-430f1204594c@googlegroups.com> |
lehs wrote:
> In the link above Charles Moore is cited:
>
> "I remain adamant that local variables are not only useless,
> they are harmful.
>
> "If you are writing code that needs them you are writing
> non-optimal code. Don't use local variables. Don't come up
> with new syntax for describing them and new schemes for
> implementing them. You can make local variables very efficient
> especially if you have local registers to store them in, but
> don't. It's bad. It's wrong.
I.e., wicked, sinful, intolerable, and heathenish.
Chuck seems to have been an obsessive-compulsive type,
a perfectionist who felt very insecure when he could
not examine and understand every byte and bit of a
software system.
If you don't use locals, then in order to keep the code
readable and avoid stack-juggling you must do an extreme
amount of factoring. This creates a problem. You have
defined such a multitude of words that you cannot remember all
of them and what they do. And in order to try to help
yourself remember the words and what they do, you have to rack
your brains and waste a lot of time coming up with just the
right names for the words.
Just about every language uses locals extensively. If Chucky
is right, then there are no programs in those languages that
contain optimal code. I find it impossible to believe that
code in C that uses locals is always non-optimal. It is very
difficult to find any Forth compiler that can come close to
matching the speed of programs produced by a top-notch C compiler.
And C code tends to be more readable than Forth code.
So when little Chucky whined that locals are evil, and that
those who use them are moral reprobates, what he really meant
was that they worried and frightened him.
It seems to me that Chucky would be out of his element
if he were assigned the task of writing a program larger
and more complex than one that flushes a toilet.
"We should forget about small efficiencies, say about 97% of
the time: premature optimization is the root of all evil."
--- Donald Knuth
: BOXTEST ( length width height -- )
6 > ROT 22 > ROT 19 > AND AND
IF ." Big enough " THEN ;
Wow. Talk about code that is not "optimal".
Using Chucky's Forth, logical operators are not short-circuiting.
Extremely crude and primitive and cumbersome.
Easy for the language implementor, difficult for the language user.
The resulting program is not efficient, and programming in the
language is grossly inefficient.
And tell me quickly, what is the minimal value for width?
: boxtest { len wd ht -- }
len 22 >
wd 19 >
ht 6 >
and and if ." Big enough." then ;
Which is more readable and understandable?
Which is more maintainable?
With which, by inspection, do you have a better chance of
determining its correctness?
From Structure and Interpretation of Computer Programs:
"First, we want to establish the idea that a computer language
is not just a way of getting a computer to perform operations,
but rather that it is a novel formal medium for expressing
ideas about methodology. Thus, programs must be written
for people to read, and only incidentally for machines to
execute."
--
Therefore, a dying empire and its fearful elite is always willing to resort to
massive violence against the citizens of the empire in order to turn them into
slaves. www.kolumbus.fi/aquilon/america-middle-class-and-the-end-of-growth.htm
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [Poll] Computing favorities Roberto Waltman <usenet@rwaltman.com> - 2015-10-10 19:28 -0400
Re: [Poll] Computing favorities lehs <skydda.barnen@gmail.com> - 2015-10-11 01:27 -0700
Re: [Poll] Computing favorities franck.bensusan@gmail.com - 2015-10-11 07:24 -0700
Re: [Poll] Computing favorities hughaguilar96@gmail.com - 2015-10-11 16:31 -0700
Re: [Poll] Computing favorities Mark Wills <markwills1970@gmail.com> - 2015-10-12 01:55 -0700
Re: [Poll] Computing favorities anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-12 09:14 +0000
Re: [Poll] Computing favorities Howerd <howerdo@yahoo.co.uk> - 2015-10-12 01:04 -0700
Re: [Poll] Computing favorities "WJ" <w_a_x_man@yahoo.com> - 2015-10-12 09:20 +0000
Re: [Poll] Computing favorities lehs <skydda.barnen@gmail.com> - 2015-10-12 12:34 -0700
Re: [Poll] Computing favorities hughaguilar96@gmail.com - 2015-10-12 17:07 -0700
Re: [Poll] Computing favorities rickman <gnuarm@gmail.com> - 2015-10-12 21:20 -0400
Re: [Poll] Computing favorities lehs <skydda.barnen@gmail.com> - 2015-10-13 13:05 -0700
Re: [Poll] Computing favorities lehs <skydda.barnen@gmail.com> - 2015-10-13 13:08 -0700
csiph-web