Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #52525
| From | rickman <gnuarm@gmail.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Average swaps per word? |
| Date | 2016-11-10 21:30 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <o03aed$d47$1@dont-email.me> (permalink) |
| References | (5 earlier) <JdmdnfjTv9wWLLnFnZ2dnUU7-QGdnZ2d@supernews.com> <o02ehv$9oi$1@dont-email.me> <PoudnbA3WJT5X7nFnZ2dnUU7-bWdnZ2d@supernews.com> <o02p1l$k4a$1@dont-email.me> <A8WdnaCjJYGjuLjFnZ2dnUU7-KnNnZ2d@supernews.com> |
On 11/10/2016 8:56 PM, Elizabeth D. Rather wrote: > On 11/10/16 11:33 AM, rickman wrote: >> On 11/10/2016 1:54 PM, Andrew Haley wrote: >>> rickman <gnuarm@gmail.com> wrote: >>>> On 11/10/2016 12:42 PM, Andrew Haley wrote: >>>>> rickman <gnuarm@gmail.com> wrote: >>>>> >>>>>> I'm from the school that believes stack ops are by definition >>>>>> "juggling" and a waste of programmer time and effort. In other >>>>>> languages the programmer does not have to think about register >>>>>> allocation or memory use. This is handled automatically. >>>>>> >>>>>> I suppose that is why local variables were added to Forth though, >>>>>> were they not? If you don't like stack juggling, then use local >>>>>> variables. >>>>> >>>>> I don't think that locals help as much as some people think. After >>>>> all, storing things in locals and fetching them out again is still >>>>> moving stuff around. And there are other ways of solving the problem >>>>> than locals. >>>> >>>> You are talking about run time efficiency. >>> >>> I'm not, not really anyway. I'm talking about words in your program >>> -- words in the source code -- that are nothing more than moving stuff >>> about. Creating locals and getting values out of them is still >>> "moving stuff about". >>> >>> The Forth ideal is to have a pipeline of words interconnected by the >>> stack. Of course, in the real world nothing is quite as ideal as >>> that, so you still need some noise words to get things into position. >>> And as we've seen with our latest (highly contrived) example, it can >>> get very weird. >> >> I suppose you are a serious forth user. I am not. I use Forth as often >> as I drive my friend's car. I have a stick, she has an automatic. I >> still want to push in the clutch when I come to a stop. I see using an >> object name as natural and not as "moving" stuff around. >> >> Maybe that's not a good analogy. My point is I don't have to think as >> much to use the name of an object as I do to remember where it is on the >> stack and to juggle the stack to get it where it can be used. That is >> the only real limitation of a stack, the fact that it is invisible other >> than in ones mind as a program is being written. This is a significant >> enough limitation that techniques are used to minimize the impact, such >> as keeping every word short and to the point. Of course this is >> recommended for all languages, but every word adds overhead. The cost >> of that overhead is less with forth while the impact of longer words is >> not as great in languages that use explicit routine parameters. It's a >> trade off. Each approach has costs and advantages. >> >> So while using a name of an object may result in data movement, I don't >> have to think about that explicitly. I just know I am using it or I am >> passing it to another word. I don't care that the underlying mechanism >> is the stack. > > The other point of view is that it's easier on the brain not to have to > remember so many names of things :-) I think you hit the nail on the > head when you said you didn't use Forth very often, and your analogy to > driving with a stick or automatic is pretty good. A person who normally > drives a stick shift car never things explicitly about shifting gears, > they just do it. And they like not having to buy as much gas as the > folks using the automatics. > > If you use Forth regularly, you rarely think much about the stack, > because all you're concerned about in the moment are the one or two > arguments to the word you're writing, and you document them so you'll > know next time. We find that easier on the mind than having to think up > more names and document what they do. As I've often said, it's like > learning to ride a bicycle: wobbly at first, but thereafter smooth and > natural. It's a different paradigm from most other programming > languages, so unfamiliar at first, but comfortable thereafter. I'm sure this could be debated back and forth (no pun intended). When you talk about the "extra" work of thinking up names and documenting these variables, if they are simply replacing the procedure inputs and outputs, they should be documented already. There is no extra work to using the same notation as used in the stack documentation. To each their own, but I think it is a tough sell to say the stack is easier on the brain. I know the manual transmission is *not* easier to use. As you say it is usually mentally automatic, but there has been more than once that I down shifted to the wrong gear for the speed after having to hit my brakes. It is not often, but there are plenty of times when I let the clutch out a bit too fast and the shift is not smooth. I never have that problem with an automatic transmission. I remember the days when a C compiler could not be trusted to produce good or even *correct* code. But those days are largely past and a good compiler will do as well as a person in generating efficient code. The stack may be something you get used to, but it will never be the *better* tool. -- Rick C
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Average swaps per word? trans <transfire@gmail.com> - 2016-11-08 22:03 -0800
Re: Average swaps per word? "Elizabeth D. Rather" <erather@forth.com> - 2016-11-08 20:20 -1000
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-09 08:16 +0000
Re: Average swaps per word? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-09 03:34 -0500
Re: Average swaps per word? trans <transfire@gmail.com> - 2016-11-09 02:53 -0800
Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-09 11:50 -0500
Re: Average swaps per word? stephen@mpeforth.com (Stephen Pelc) - 2016-11-09 18:37 +0000
Re: Average swaps per word? Harold <hzrabbie@gmail.com> - 2016-11-10 16:28 -0800
Re: Average swaps per word? stephen@mpeforth.com (Stephen Pelc) - 2016-11-11 17:51 +0000
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-12 12:23 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-12 16:09 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-13 14:55 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-13 20:34 +0100
Re: Average swaps per word? Paul Rubin <no.email@nospam.invalid> - 2016-11-13 11:43 -0800
Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-13 16:58 -0800
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-14 16:41 +0100
Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-14 16:38 -0800
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-14 17:42 +0000
Re: Average swaps per word? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-14 16:39 -0500
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 12:40 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 14:10 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:14 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-20 18:16 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-22 10:29 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-22 15:54 +0100
Re: Average swaps per word? James Kuyper <jameskuyper@verizon.net> - 2016-11-22 11:50 -0500
Re: Average swaps per word? raltbos@xs4all.nl (Richard Bos) - 2016-11-24 17:27 +0000
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-15 03:55 -0600
Re: Average swaps per word? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-15 17:49 -0500
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-16 02:59 -0600
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 13:07 +0000
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-16 22:57 +0000
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-17 03:12 -0600
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 12:32 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:02 +0000
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 13:23 +0000
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-17 08:54 -0600
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:54 +0000
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-18 12:37 -0600
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-14 17:32 +0000
Re: Average swaps per word? Mark Wills <markwills1970@gmail.com> - 2016-11-15 02:09 -0800
Re: Average swaps per word? jim <anon@example.com> - 2016-11-15 10:44 +0000
Re: Average swaps per word? Mark Wills <markwills1970@gmail.com> - 2016-11-15 03:12 -0800
Re: Average swaps per word? Alex <alex@rivadpm.com> - 2016-11-15 13:01 +0000
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 12:51 +0000
Re: Average swaps per word? Alex <alex@rivadpm.com> - 2016-11-17 14:02 +0000
Re: Average swaps per word? Alex <alex@rivadpm.com> - 2016-11-17 14:06 +0000
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:26 +0000
Re: Average swaps per word? Alex <alex@rivadpm.com> - 2016-11-18 18:33 +0000
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-19 03:32 -0600
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 14:29 +0100
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-15 13:51 +0100
Re: Average swaps per word? jim <anon@example.com> - 2016-11-15 13:01 +0000
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 12:46 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 14:16 +0100
Re: Average swaps per word? Harold <hzrabbie@gmail.com> - 2016-11-13 11:08 -0800
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-14 17:08 +0000
Re: Average swaps per word? Mark Wills <markwills1970@gmail.com> - 2016-11-15 02:04 -0800
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-15 14:04 +0100
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-15 14:05 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-17 12:58 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-17 15:16 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-18 15:41 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-20 18:12 +0100
Re: Average swaps per word? minforth@arcor.de - 2016-11-09 03:15 -0800
Re: Average swaps per word? trans <transfire@gmail.com> - 2016-11-09 11:22 -0800
Re: Average swaps per word? "HAA" <someone@microsoft.com> - 2016-11-10 12:20 +1100
Re: Average swaps per word? "Elizabeth D. Rather" <erather@forth.com> - 2016-11-09 21:04 -1000
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-10 03:45 -0600
Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-10 11:52 -0500
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-10 11:42 -0600
Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-10 13:34 -0500
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-10 12:54 -0600
Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-10 16:33 -0500
Re: Average swaps per word? "Elizabeth D. Rather" <erather@forth.com> - 2016-11-10 15:56 -1000
Re: Average swaps per word? rickman <gnuarm@gmail.com> - 2016-11-10 21:30 -0500
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-11 03:04 -0600
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-12 13:25 +0000
Re: Average swaps per word? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-14 03:34 -0600
Re: Average swaps per word? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-11-11 10:41 +0000
Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-11 16:45 -0800
Re: Average swaps per word? jim <anon@example.com> - 2016-11-10 11:17 +0000
Re: Average swaps per word? Raimond Dragomir <raimond.dragomir@gmail.com> - 2016-11-10 04:34 -0800
Re: Average swaps per word? jim <anon@example.com> - 2016-11-10 12:44 +0000
Re: Average swaps per word? Raimond Dragomir <raimond.dragomir@gmail.com> - 2016-11-10 07:27 -0800
Re: Average swaps per word? Ron Aaron <rambamist@gmail.com> - 2016-11-10 18:26 +0200
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-10 16:05 +0000
Re: Average swaps per word? stephen@mpeforth.com (Stephen Pelc) - 2016-11-10 14:55 +0000
Re: Average swaps per word? "HAA" <someone@microsoft.com> - 2016-11-12 11:36 +1100
Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-11 16:56 -0800
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-12 16:14 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-12 12:14 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-12 16:16 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-13 14:51 +0000
Re: Average swaps per word? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-13 20:41 +0100
Re: Average swaps per word? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-10 14:42 +0000
Re: Average swaps per word? hughaguilar96@gmail.com - 2016-11-11 15:54 -0800
csiph-web