Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #40730 > unrolled thread
| Started by | Mux <Yvo.Zoer@gmail.com> |
|---|---|
| First post | 2015-07-21 15:40 -0700 |
| Last post | 2015-07-24 09:26 -0700 |
| Articles | 11 on this page of 51 — 22 participants |
Back to article view | Back to comp.lang.forth
Forth programming style... Mux <Yvo.Zoer@gmail.com> - 2015-07-21 15:40 -0700
Re: Forth programming style... Julian Fondren <ayrnieu@gmail.com> - 2015-07-21 17:28 -0700
Re: Forth programming style... Julian Fondren <ayrnieu@gmail.com> - 2015-07-21 17:39 -0700
Re: Forth programming style... Mark Wills <markwills1970@gmail.com> - 2015-07-22 00:48 -0700
Re: Forth programming style... "Elizabeth D. Rather" <erather@forth.com> - 2015-07-21 22:25 -1000
Re: Forth programming style... onewingedshark@gmail.com - 2015-07-22 15:13 -0700
Re: Forth programming style... "Elizabeth D. Rather" <erather@forth.com> - 2015-07-22 13:24 -1000
Re: Forth programming style... stephen@mpeforth.com (Stephen Pelc) - 2015-07-23 08:28 +0000
Re: Forth programming style... Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-07-22 02:38 -0700
Re: Forth programming style... Mark Wills <markwills1970@gmail.com> - 2015-07-22 03:14 -0700
Re: Forth programming style... humptydumpty <ouatubi@gmail.com> - 2015-07-22 03:45 -0700
Re: Forth programming style... "Elizabeth D. Rather" <erather@forth.com> - 2015-07-22 08:37 -1000
Re: Forth programming style... Paul Rubin <no.email@nospam.invalid> - 2015-07-22 12:51 -0700
Re: Forth programming style... "Elizabeth D. Rather" <erather@forth.com> - 2015-07-22 10:14 -1000
Re: Forth programming style... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-07-23 06:23 +0000
Re: Forth programming style... hughaguilar96@gmail.com - 2015-07-23 16:59 -0700
Re: Forth programming style... hughaguilar96@gmail.com - 2015-07-23 20:18 -0700
Re: Forth programming style... "HAA" <someone@microsoft.com> - 2015-07-28 21:06 +1000
Re: Forth programming style... "Alex McDonald" <blog@rivadpm.com> - 2015-07-28 12:38 +0100
Re: Forth programming style... "HAA" <someone@microsoft.com> - 2015-07-23 00:02 +1000
Re: Forth programming style... hughaguilar96@gmail.com - 2015-07-22 21:21 -0700
Re: Forth programming style... "WJ" <w_a_x_man@yahoo.com> - 2015-07-23 09:05 +0000
Re: Forth programming style... hughaguilar96@gmail.com - 2015-07-23 16:47 -0700
Re: Forth programming style... Mark Wills <markwills1970@gmail.com> - 2015-07-24 01:24 -0700
Re: Forth programming style... franck.bensusan@gmail.com - 2015-07-24 03:48 -0700
Re: Forth programming style... Paul Rubin <no.email@nospam.invalid> - 2015-07-24 18:15 -0700
Re: Forth programming style... "HAA" <someone@microsoft.com> - 2015-08-01 13:21 +1000
Re: Forth programming style... hughaguilar96@gmail.com - 2015-07-22 21:48 -0700
Re: Forth programming style... Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-07-22 22:28 -0700
Re: Forth programming style... Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-02 00:43 +0200
Re: Forth programming style... Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-02 00:22 +0200
Re: Forth programming style... hughaguilar96@gmail.com - 2015-08-01 16:41 -0700
Re: Forth programming style... "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-08-01 22:01 -0400
Re: Forth programming style... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-08-02 05:50 +0000
Re: Forth programming style... Bernd Paysan <bernd.paysan@gmx.de> - 2015-08-02 16:33 +0200
Re: Forth programming style... "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-08-01 22:04 -0400
Re: Forth programming style... "Elizabeth D. Rather" <erather@forth.com> - 2015-08-02 08:54 -0500
Re: Forth programming style... "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-08-03 04:51 -0400
Re: Forth programming style... "Elizabeth D. Rather" <erather@forth.com> - 2015-08-03 17:36 -0500
Re: Forth programming style... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-07-22 10:16 +0000
Re: Forth programming style... mhx@iae.nl - 2015-07-22 10:02 -0700
Re: Forth programming style... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-07-22 10:09 +0000
Re: Forth programming style... Syd Rumpo <usenet@nononono.co.uk> - 2015-07-22 12:16 +0100
Re: Forth programming style... Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-07-22 07:59 -0700
Re: Forth programming style... glidedog@gmail.com - 2015-07-23 04:24 -0700
Re: Forth programming style... "Ala'a Alawi" <amalawi@gmail.com> - 2015-07-23 19:32 -0700
Re: Forth programming style... hughaguilar96@gmail.com - 2015-07-23 21:33 -0700
Re: Forth programming style... borota@gmail.com - 2015-07-23 22:09 -0700
Re: Forth programming style... hughaguilar96@gmail.com - 2015-07-23 22:57 -0700
Re: Forth programming style... "Ala'a Alawi" <amalawi@gmail.com> - 2015-07-24 09:26 -0700
Re: Forth programming style... "Ala'a Alawi" <amalawi@gmail.com> - 2015-07-24 09:26 -0700
Page 3 of 3 — ← Prev page 1 2 [3]
| From | mhx@iae.nl |
|---|---|
| Date | 2015-07-22 10:02 -0700 |
| Message-ID | <b60c9832-3779-47a2-8cb3-12f9cd134164@googlegroups.com> |
| In reply to | #40732 |
On Wednesday, July 22, 2015 at 2:39:02 AM UTC+2, Julian Fondren wrote: > On Tuesday, July 21, 2015 at 7:28:08 PM UTC-5, Julian Fondren wrote: > > But if you want rules, these are the best: > > https://groups.google.com/d/msg/comp.lang.forth/BNjiUjmN2pw/SHwGuf4lqK4J > > From that: > > > These rules are not for beginners learning their Forth ABCs but might be > > helpful to a person who has written a program and wants to make it > > clearer. > > Rules for beginners would be more like: > > 1. Use stack comments! > 2. Don't use locals! It is like that joke about left and right being age-dependent. Beginners shall zealously use the stack, but if they still use it when they're proficient in Forth, they should have their head examined. > 3. Don't write definitions longer than 3-5 lines! > 4. Here's a list of naming conventions. > 5. Please still try to use a human language with your names. > 6. Don't use vocabularies. > 7. You probably don't need that cool feature from language X. > 8. Don't let holier-than-thou Forth programmers make you > wear a straitjacket. After pulling your hair out for a > while, you'll go raving mad and run off to learn Common > Lisp or Haskell or something, and literally nobody wants > that. I am learning Haskell and Python right now, but after Forth, everything is so incredibly boring. -marcel
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2015-07-22 10:09 +0000 |
| Message-ID | <2015Jul22.120918@mips.complang.tuwien.ac.at> |
| In reply to | #40731 |
Julian Fondren <ayrnieu@gmail.com> writes:
> I still do like kc5tja's
>emphasis on not caring if words 'redefine' earlier words,
>as this takes advantage of Forth's dictionary to let you
>be freer with your names.
Diasdvantage: you cannot directly test the shadowed word.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2015: http://www.mpeforth.com/euroforth2015/euroforth2015.htm
[toc] | [prev] | [next] | [standalone]
| From | Syd Rumpo <usenet@nononono.co.uk> |
|---|---|
| Date | 2015-07-22 12:16 +0100 |
| Message-ID | <montur$htn$1@dont-email.me> |
| In reply to | #40730 |
On 21/07/2015 23:40, Mux wrote: > This has probably been discussed to death but I wanted to get an update on what people have adopted. Personally, I've subscribed to Chuck's '1-liner' method where I try to break bigger functions down into small, single line words that eventually get called to build the function. > > Anyone? > > -Mux > _Always_ include the number base in a literal (eg $49, #73 %01001001 or similar convention). OK, maybe not 0 and 1, but why not. Cheers -- Syd
[toc] | [prev] | [next] | [standalone]
| From | Raimond Dragomir <raimond.dragomir@gmail.com> |
|---|---|
| Date | 2015-07-22 07:59 -0700 |
| Message-ID | <ce22295c-23b1-4f07-a74f-0d2cc3c97b5c@googlegroups.com> |
| In reply to | #40743 |
miercuri, 22 iulie 2015, 14:16:07 UTC+3, Syd Rumpo a scris: > On 21/07/2015 23:40, Mux wrote: > > This has probably been discussed to death but I wanted to get an update on what people have adopted. Personally, I've subscribed to Chuck's '1-liner' method where I try to break bigger functions down into small, single line words that eventually get called to build the function. > > > > Anyone? > > > > -Mux > > > _Always_ include the number base in a literal (eg $49, #73 %01001001 or > similar convention). OK, maybe not 0 and 1, but why not. > > Cheers > -- > Syd Hehe, I forgot about that. For me it is so obvious that I enforced this rule in the interpreter. I don't have a BASE variable for numeric input. My BASE (because I have one however) is only for numeric output formatting. Numeric input (literals) is controlled by number prefixes.
[toc] | [prev] | [next] | [standalone]
| From | glidedog@gmail.com |
|---|---|
| Date | 2015-07-23 04:24 -0700 |
| Message-ID | <02835ea7-f46a-4fbd-8c94-f83d823474bc@googlegroups.com> |
| In reply to | #40730 |
On 7/21/15 6:40 PM, Mux wrote: > This has probably been discussed to death but I wanted to get an > update on what people have adopted. Personally, I've subscribed to > Chuck's '1-liner' method where I try to break bigger functions down > into small, single line words that eventually get called to build > the function. You will get many different answers because people are different and have different needs and Forth is used for many different purposes. Forth is very malleable so it easily accommodates many different styles. You are smart to study the recommendations and styles of others and there are some widely accepted best practices such as always include stack comments. (Although I never include a stack comment for a definition that doesn't consume or leave stack items. No stack comment = no stack effect.) Thinking Forth is good read and has a good section on style. If you program as part of a work group then your style may be largely dictated. If you program alone then you are free to adopt/create your own style. In resource constrained use the typical Forth system rewards efficient stack use. In a resource rich environment one's style may include the use of locals. For example I value my time and therefore the time it takes to solve a problem and have no issue in using locals when they help. And no, I *don't* always reach for locals first. After awhile one realizes that one is just rearranging items on the stack, not solving the problem at hand. Or one is spending time rearranging the problem just so the stack comes out "nice". Again, this can distract me from solving the problem at hand. This is a somewhat controversial topic so I'll leave it at that. One of the nice things about Forth is the compiler does not get in your way via type checking and other rigid rules. -Doug
[toc] | [prev] | [next] | [standalone]
| From | "Ala'a Alawi" <amalawi@gmail.com> |
|---|---|
| Date | 2015-07-23 19:32 -0700 |
| Message-ID | <a1dda0e6-f961-4d7e-b52d-bb74c34940a3@googlegroups.com> |
| In reply to | #40730 |
Hi Mux, Here are other notes, style and methods emphasized by the Chuck that I'd documented for myself from his writings, talks and Jeff fox site (http://www.ultratechnology.com): - Always try to move decision on anything in your program earlier rather than later on (Runtime > Compilation > Edit time > Design time). - Early binding rather than late binding - Keep block/screen size to 1 KB. This is one of forth key stones as per its creator (the other two being 'words' and 'stacks') - Avoid unsolvable problems. - Emphasis on Thoughtful/mindful/through thinking/discipline with patients/paying attention - Scaling (integer scaling). - Avoid locals. - The following are words that Charles advertised against their usage: - postpone - pick - roll - +loop - depth - No more than 1-2 arguments per word. - No more than 3-4 deep stack manipulation per word. - Remove more than what you added. - Definitions should be 5 to 7 words. - No hooks (a place holder for later upgrade since you do not know where it will be and if guessed, its is mostly in the other direction) - (Ala'a: in other words, solve only the current problem.) From the above: Keep it simple and stupid, and only solve what is required. Also here is a webpage by Jeff that in which he explains Chuck problem solving method (http://www.ultratechnology.com/method.htm) Remember: Take the above with a grain of salt. Also, corrections are welcome (with reference please, if possible) Regards, Ala'a
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2015-07-23 21:33 -0700 |
| Message-ID | <043389b7-9b2a-4d04-be6e-b13aee6797ed@googlegroups.com> |
| In reply to | #40766 |
On Thursday, July 23, 2015 at 7:32:58 PM UTC-7, Ala'a Alawi wrote: > - The following are words that Charles advertised against their usage: > - postpone Well, Charles Moore ought to hate my novice-package, as I use POSTPONE extensively. Actually, it seems unlikely that Charles Moore advised against POSTPONE --- meta-compiling is one of Forth's best features --- if we can't write code that executes at compile-time and generates code that executes at run-time, then we might as well just program in C. But I don't claim to have any particular insight into Charles Moore's thinking --- I just do what I want to do, and the rest will follow --- Elizabeth Rather has already said that I'm not a Forth programmer, so maybe Charles Moore will show up on comp.lang.forth one day solely for the purpose of saying that I'm not a Forth programmer (I would be quite honored to be denounced by Charles Moore himself; anybody can get denounced by the priests and sycophants as they are pretty free with their denunciations, but it takes real talent to offend the gods).
[toc] | [prev] | [next] | [standalone]
| From | borota@gmail.com |
|---|---|
| Date | 2015-07-23 22:09 -0700 |
| Message-ID | <a4441939-8ab8-48d6-a7e5-685808f775cb@googlegroups.com> |
| In reply to | #40769 |
On Thursday, July 23, 2015 at 11:33:51 PM UTC-5, hughag...@gmail.com wrote: > On Thursday, July 23, 2015 at 7:32:58 PM UTC-7, Ala'a Alawi wrote: > > - The following are words that Charles advertised against their usage: > > - postpone > > Well, Charles Moore ought to hate my novice-package, as I use POSTPONE extensively. > > Actually, it seems unlikely that Charles Moore advised against POSTPONE --- meta-compiling is one of Forth's best features --- if we can't write code that executes at compile-time and generates code that executes at run-time, then we might as well just program in C. > > But I don't claim to have any particular insight into Charles Moore's thinking --- I just do what I want to do, and the rest will follow --- Elizabeth Rather has already said that I'm not a Forth programmer, so maybe Charles Moore will show up on comp.lang.forth one day solely for the purpose of saying that I'm not a Forth programmer (I would be quite honored to be denounced by Charles Moore himself; anybody can get denounced by the priests and sycophants as they are pretty free with their denunciations, but it takes real talent to offend the gods). From http://www.greenarraychips.com/home/documents/greg/DB004-131030-aFUSER.pdf [c] (Cyan text) enters words only. Not relevant for F18 code, but analogous to POSTPONE in ANS Forth when compiling x86 code. So colorForth seems to have it too.
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2015-07-23 22:57 -0700 |
| Message-ID | <c84245b0-3eb5-467d-abbb-ef449788b497@googlegroups.com> |
| In reply to | #40770 |
On Thursday, July 23, 2015 at 10:09:43 PM UTC-7, bor...@gmail.com wrote: > On Thursday, July 23, 2015 at 11:33:51 PM UTC-5, hughag...@gmail.com wrote: > > On Thursday, July 23, 2015 at 7:32:58 PM UTC-7, Ala'a Alawi wrote: > > > - The following are words that Charles advertised against their usage: > > > - postpone > > > > Well, Charles Moore ought to hate my novice-package, as I use POSTPONE extensively. > > > > Actually, it seems unlikely that Charles Moore advised against POSTPONE --- meta-compiling is one of Forth's best features --- if we can't write code that executes at compile-time and generates code that executes at run-time, then we might as well just program in C. > > > > But I don't claim to have any particular insight into Charles Moore's thinking --- I just do what I want to do, and the rest will follow --- Elizabeth Rather has already said that I'm not a Forth programmer, so maybe Charles Moore will show up on comp.lang.forth one day solely for the purpose of saying that I'm not a Forth programmer (I would be quite honored to be denounced by Charles Moore himself; anybody can get denounced by the priests and sycophants as they are pretty free with their denunciations, but it takes real talent to offend the gods). > > From http://www.greenarraychips.com/home/documents/greg/DB004-131030-aFUSER.pdf > [c] (Cyan text) enters words only. Not relevant for F18 code, but analogous to POSTPONE in ANS Forth when compiling x86 code. > > So colorForth seems to have it too. If you can't have immediate words, then the only alternative is for COMPILE, to special-case all of the words that would normally be immediate (such as: IF etc.) --- but that is Stephen Pelc's idea of Forth, not Charles Moore's. In ANS-Forth, FIND is completely screwed-up --- we have section 4.1.2 that says it is ambiguous for FIND or tick to obtain the xt of the special-case words, and section 6.1.1550 that says: "For a given string, the values returned by FIND while compiling may differ from those returned while not compiling." So, as a practical matter, the ANS-Forth programmer has no idea what FIND is going to do --- it is all ambiguous and pretty much anything is possible. My disambiguifiers work around the ambiguity in FIND however, by using POSTPONE instead. For example: : if state @ 0= abort" *** no interpretation semantics for: IF ***" postpone if ; immediate Now FIND works the same way on every ANS-Forth compliant compiler, and it works in a way that makes sense (words like IF that should be immediate are immediate). If we don't have POSTPONE then we are totally screwed! Without POSTPONE we can't have the disambiguifiers, and so we are left with the highly ambiguous FIND that works differently on every ANS-Forth compliant compiler. I think that the ANS-Forth committee made FIND ambiguous for the purpose of preventing the ANS-Forth programmers from writing cross-compilers --- but they either forgot to make POSTPONE ambiguous or they lacked the courage to do this as it would totally prevent meta-compiling in ANS-Forth which people would notice, so they left POSTPONE as a loophole in their sabotage. Now my disambiguifiers take advantage of this loophole to work around the ambiguity and confusion that the committee worked so hard to create). Maybe Elizabeth Rather can psychically channel Charles Moore and inform us that Charles Moore wants Forth to be ambiguous and that we must all embrace ambiguity (a kind of original sin) or be excommunicated.
[toc] | [prev] | [next] | [standalone]
| From | "Ala'a Alawi" <amalawi@gmail.com> |
|---|---|
| Date | 2015-07-24 09:26 -0700 |
| Message-ID | <fa405bc3-9312-4103-9c38-5efad9afded9@googlegroups.com> |
| In reply to | #40770 |
On Friday, July 24, 2015 at 9:09:43 AM UTC+4, bor...@gmail.com wrote: > From http://www.greenarraychips.com/home/documents/greg/DB004-131030-aFUSER.pdf > [c] (Cyan text) enters words only. Not relevant for F18 code, but analogous to POSTPONE in ANS Forth when compiling x86 code. > > So colorForth seems to have it too. I did not check colorForth, but searching again you are correct it seems to be the Cyan words, but you can check the following page from Jeff Fox site http://www.ultratechnology.com/forth2.htm (search for postpone) and it seems that it maybe Jeff's interpretation rather than literal quote. Thanks for the feedback. Ala'a
[toc] | [prev] | [next] | [standalone]
| From | "Ala'a Alawi" <amalawi@gmail.com> |
|---|---|
| Date | 2015-07-24 09:26 -0700 |
| Message-ID | <d5c326d6-8bd0-4168-a0eb-18546d3d84cb@googlegroups.com> |
| In reply to | #40769 |
On Friday, July 24, 2015 at 8:33:51 AM UTC+4, hughag...@gmail.com wrote: > On Thursday, July 23, 2015 at 7:32:58 PM UTC-7, Ala'a Alawi wrote: > > - The following are words that Charles advertised against their usage: > > - postpone > > Well, Charles Moore ought to hate my novice-package, as I use POSTPONE extensively. http://www.ultratechnology.com/forth2.htm (search for postpone), but as pointed by bor...@gmail.com, colorforth do use it! Ala'a
[toc] | [prev] | [standalone]
Page 3 of 3 — ← Prev page 1 2 [3]
Back to top | Article view | comp.lang.forth
csiph-web