Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #49737 > unrolled thread

The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

Started byJUERGEN <epldfpga@aol.com>
First post2016-08-02 09:33 -0700
Last post2016-08-20 01:43 -0700
Articles 20 on this page of 91 — 19 participants

Back to article view | Back to comp.lang.forth


Contents

  The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc JUERGEN <epldfpga@aol.com> - 2016-08-02 09:33 -0700
    Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc Paul Rubin <no.email@nospam.invalid> - 2016-08-02 10:35 -0700
      Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc JUERGEN <epldfpga@aol.com> - 2016-08-02 11:46 -0700
        Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-03 00:04 -0700
          Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-04 00:41 -0700
            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc rickman <gnuarm@gmail.com> - 2016-08-04 09:35 -0400
              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-04 10:08 -0500
    Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc Brad Eckert <hwfwguy@gmail.com> - 2016-08-02 15:45 -0700
      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-02 19:56 -0500
        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc JUERGEN <epldfpga@aol.com> - 2016-08-02 22:43 -0700
        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-03 00:12 -0700
          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-03 02:42 -0500
            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-03 10:41 -0700
              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-03 12:56 -0500
              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-03 13:09 -0500
                Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc rickman <gnuarm@gmail.com> - 2016-08-03 14:15 -0400
                  Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Richard Owlett <rowlett@cloud85.net> - 2016-08-03 18:00 -0500
                    Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-05 20:35 -0700
                      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-06 00:16 -0500
                        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-06 16:58 -0700
                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-06 18:01 -0700
                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-06 21:28 -0500
                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-06 19:46 -0700
                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-06 22:54 -0500
                                Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Julian Fondren <julian.fondren@gmail.com> - 2016-08-06 21:39 -0700
                                  Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Paul Rubin <no.email@nospam.invalid> - 2016-08-06 22:28 -0700
                                Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-06 23:49 -0700
                                  Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-07 02:32 -0500
                                    Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Paul Rubin <no.email@nospam.invalid> - 2016-08-07 01:06 -0700
                                      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-07 07:05 -0500
                                        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-07 13:01 -0700
                                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-07 16:02 -0500
                                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-07 14:20 -0700
                                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc franck.bensusan@gmail.com - 2016-08-08 03:13 -0700
                                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-08 11:25 -0500
                                        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Paul Rubin <no.email@nospam.invalid> - 2016-08-07 13:55 -0700
                                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-07 16:22 -0500
                                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-07 15:03 -0700
                                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Håkan Thörngren <hth313@gmail.com> - 2016-08-07 23:02 -0700
                                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc "Elizabeth D. Rather" <erather@forth.com> - 2016-08-07 21:10 -1000
                                                Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-09 00:36 -0700
                                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-08 09:06 +0000
                                      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-07 09:33 -0700
                                        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Håkan Thörngren <hth313@gmail.com> - 2016-08-07 11:31 -0700
                                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-07 12:35 -0700
                                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-07 16:11 -0500
                                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Håkan Thörngren <hth313@gmail.com> - 2016-08-07 22:43 -0700
                                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Håkan Thörngren <hth313@gmail.com> - 2016-08-07 22:48 -0700
                                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-08 08:34 +0000
                                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-08 23:59 -0700
                                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-09 13:53 +0000
                                                Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-10 19:56 -0700
                                                  Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Julian Fondren <julian.fondren@gmail.com> - 2016-08-11 00:33 -0700
                                                  Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-11 11:58 +0000
                                                    Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-11 13:16 -0700
                                                      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc stephen@mpeforth.com (Stephen Pelc) - 2016-08-11 23:36 +0000
                                                        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-11 20:49 -0700
                                                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-28 11:20 -0700
                                                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-28 17:33 -0700
                                                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-28 21:10 -0500
                                                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-28 22:49 -0700
                                                        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-12 23:10 -0700
                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Julian Fondren <julian.fondren@gmail.com> - 2016-08-06 20:20 -0700
                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-07 09:58 -0700
                                Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Julian Fondren <julian.fondren@gmail.com> - 2016-08-07 11:08 -0700
                                  Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-08 09:10 +0000
                                    Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-08 10:47 +0000
                                      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc JennyB <jennybrien@googlemail.com> - 2016-08-08 13:44 -0700
                                    Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc mhx@iae.nl - 2016-08-08 11:32 -0700
                                      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-09 06:13 +0000
                                      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-09 06:19 +0000
                                        Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc mhx@iae.nl - 2016-08-09 02:54 -0700
                                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-09 10:22 +0000
                          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc lawrencedo99@gmail.com - 2016-08-15 20:33 -0700
                            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-16 10:40 -0700
                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc lawrencedo99@gmail.com - 2016-08-17 02:21 -0700
                              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-17 11:14 -0700
          Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Roberto Waltman <usenet@rwaltman.com> - 2016-08-03 18:21 -0400
      Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc rickman <gnuarm@gmail.com> - 2016-08-03 02:46 -0400
    Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc endlessboomcapitalism@gmail.com - 2016-08-13 09:51 -0700
      Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc JUERGEN <epldfpga@aol.com> - 2016-08-13 12:18 -0700
        Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc endlessboomcapitalism@gmail.com - 2016-08-14 19:13 -0700
          Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc JUERGEN <epldfpga@aol.com> - 2016-08-15 07:43 -0700
            Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Cecil Bayona <cbayona@cbayona.com> - 2016-08-15 12:34 -0500
              Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc Brad Eckert <hwfwguy@gmail.com> - 2016-08-17 22:08 -0700
                Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-18 15:26 -0700
        Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc endlessboomcapitalism@gmail.com - 2016-08-14 19:18 -0700
        Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc hughaguilar96@gmail.com - 2016-08-15 08:24 -0700
          Re: The Fourth Forth eBook in our little series  - Programming Forth - Stephen Pelc JUERGEN <epldfpga@aol.com> - 2016-08-15 08:31 -0700
            Re: The Fourth Forth eBook in our little series - Programming Forth- Stephen Pelc "WJ" <w_a_x_man@yahoo.com> - 2016-08-19 23:54 +0000
              Re: The Fourth Forth eBook in our little series - Programming Forth- Stephen Pelc JUERGEN <epldfpga@aol.com> - 2016-08-20 01:43 -0700

Page 1 of 5  [1] 2 3 4 5  Next page →


#49737 — The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromJUERGEN <epldfpga@aol.com>
Date2016-08-02 09:33 -0700
SubjectThe Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<efc1b6fc-c4de-4115-9d0d-16a2fa3dfb1d@googlegroups.com>
It took longer than expected, but as Stephen allowed me to reformat his book for publication on amazon, it had to be finished - came out today https://www.amazon.co.uk/dp/B01JIWVB5S  or your local amazon.
After Chuck Moore   - Early Years https://www.amazon.de/dp/B00JZI64U8
and   Chuck Moore  - Programming a Problem Oriented Language  https://www.amazon.de/dp/B00K3PIYX2
leading to the Forth Lite Tutorial - https://www.amazon.de/dp/B00L0F32Q8
we have 4 now.
Enjoy Stephen's eBook.

[toc] | [next] | [standalone]


#49738

FromPaul Rubin <no.email@nospam.invalid>
Date2016-08-02 10:35 -0700
Message-ID<87invj5b0s.fsf@jester.gateway.pace.com>
In reply to#49737
JUERGEN <epldfpga@aol.com> writes:
> It took longer than expected, but as Stephen allowed me to reformat
> his book for publication on amazon, it had to be finished - came out
> today https://www.amazon.co.uk/dp/B01JIWVB5S

Neat!  Is this (reformatted) the same book as on the MPE web site?  I
don't use a Kindle myself, but Kindle users will probably appreciate the
conversion.

[toc] | [prev] | [next] | [standalone]


#49743

FromJUERGEN <epldfpga@aol.com>
Date2016-08-02 11:46 -0700
Message-ID<5bf4f204-8657-45b1-84a1-e3ba8196fae8@googlegroups.com>
In reply to#49738
On Tuesday, August 2, 2016 at 6:35:52 PM UTC+1, Paul Rubin wrote:
> JUERGEN <epldfpga@aol.com> writes:
> > It took longer than expected, but as Stephen allowed me to reformat
> > his book for publication on amazon, it had to be finished - came out
> > today https://www.amazon.co.uk/dp/B01JIWVB5S
> 
> Neat!  Is this (reformatted) the same book as on the MPE web site?  I
> don't use a Kindle myself, but Kindle users will probably appreciate the
> conversion.

Yes it is the same, just 2 little bits added, especially some info about the Sockpuppet, but a lot of bookmarks, links  and formatting. I added bookmarks as it was missing in most other Forth books I had seen - where is the word described in the book? Many here will not need the book to learn - but this is not the real target group.

[toc] | [prev] | [next] | [standalone]


#49757

Fromhughaguilar96@gmail.com
Date2016-08-03 00:04 -0700
Message-ID<ad70f46d-969d-4eb3-95d2-e65d53115d6a@googlegroups.com>
In reply to#49743
On Tuesday, August 2, 2016 at 11:46:25 AM UTC-7, JUERGEN wrote:
> On Tuesday, August 2, 2016 at 6:35:52 PM UTC+1, Paul Rubin wrote:
> > JUERGEN <epldfpga@aol.com> writes:
> > > It took longer than expected, but as Stephen allowed me to reformat
> > > his book for publication on amazon, it had to be finished - came out
> > > today https://www.amazon.co.uk/dp/B01JIWVB5S
> > 
> > Neat!  Is this (reformatted) the same book as on the MPE web site?  I
> > don't use a Kindle myself, but Kindle users will probably appreciate the
> > conversion.
> 
> Yes it is the same... Many here will not need the book to learn - but this is not the real target group.

Juergen Pintaske is a salesman for MPE --- he wasn't "allowed" to reformat the book --- it was just a work assignement.

The problem is not that I don't need the book to learn --- the problem is that the book teaches Forth badly --- makes Forth look stupid.

Here is an example from the book:

: 2Array \ n1 n2 -- ; [child] n1 n2 -- addr ; 2-D array
 Create \ create data word
 Over , \ save width for run-time
 cell * * \ calculate size
 Here over erase \ clear memory
 allot \ reserve n cells
 Does> \ run time gives address of data
 Dup @ Rot * Rot + 1+
 cell *
 +
;

This is horrible Forth code! For one thing, the ARRAY definer only supports cell-sized elements. What if you need an array of floats? You have to cut-and-paste-and-modify this code to make it work. This is not a general-purpose data-structure! By comparison, I have support for arrays in the novice-package that allow the arrays to be of any sized elements.

For another thing, the code is grossly inefficient. It is fetching the width of the array from memory at run-time --- this is an immutable constant however --- it is known at compile-time and it never changes, so it doesn't need to be stored in memory, but it can be a literal. Also, this constant value is being given to * for multiplication. If it is a power of two (it usually is) then it should get compiled as a SHL --- instead it gets compiled as an IMUL --- by comparison, my arrays in the novice-package compile into shifts rather than multiplications when they are powers of two.

Here is another example from Stephen Pelc's book:

0 constant [struct \ -- 0 ; start
\ Start a structure definition, returning zero as
\ the initial offset.
: field \ offset n -- offset+n ; addr -- addr+offset
\ When defining a structure, a field of size n starts
\ at the given offset, returning the next offset. At
\ run time, the offset is added to the base address.
 create
 over , + \ lay offset and update
 does>
 @ + \ addr offset to address
;
: struct] \ offset -- ; -- size ; end
\ End a structure definition by naming it.
 constant
;

This is more horrible Forth code! Pelc says: "The first and third words are just syntactic sugar to make the code easier to read." This doesn't make the code easier to read however. This conceals the fact that one struct can inherit from another struct. General-purpose data-structures rely heavily on inheritance --- you can't have general-purpose data-structures without inheritance --- by forcing the base value to be 0, Pelc is effectively denying the possibility of inheritance.

Also, this is grossly inefficient code. It is a CREATE DOES> word, so a CALL is required. Also, it is fetching the offset from memory, but this is a constant that is known at compile-time so it should be a literal. Also, if this value is zero (it is for the first field) then it still gets fetch from memory and added, although this is not necessary. Also, Pelc is not aligning his fields and making their size a multiple of the cell size --- this boosts speed considerably on modern processors (everything after the 1980s) --- this is also required for my SORT to work (because EXCHANGE requires the element size to be a multiple of the cell size).

All in all, I would not recommend anybody to read this book, because it makes Forth look stupid. A lot of the Forth novices are already reasonably expert in C --- they are going to read this book and go away with the belief that Forth is a toy language --- they are going to use this book as proof that Forth programmers lack an understanding of even the most rudimentary programming concepts.

[toc] | [prev] | [next] | [standalone]


#49780

Fromhughaguilar96@gmail.com
Date2016-08-04 00:41 -0700
Message-ID<cc9707e6-9dc4-431f-b394-399a6dbf5e54@googlegroups.com>
In reply to#49757
On Wednesday, August 3, 2016 at 12:04:34 AM UTC-7, hughag...@gmail.com wrote:
> Here is another example from Stephen Pelc's book:
> 
> 0 constant [struct \ -- 0 ; start
> \ Start a structure definition, returning zero as
> \ the initial offset.
> : field \ offset n -- offset+n ; addr -- addr+offset
> \ When defining a structure, a field of size n starts
> \ at the given offset, returning the next offset. At
> \ run time, the offset is added to the base address.
>  create
>  over , + \ lay offset and update
>  does>
>  @ + \ addr offset to address
> ;
> : struct] \ offset -- ; -- size ; end
> \ End a structure definition by naming it.
>  constant
> ;
> 
> This is more horrible Forth code! Pelc says: "The first and third words are just syntactic sugar to make the code easier to read." This doesn't make the code easier to read however. This conceals the fact that one struct can inherit from another struct. General-purpose data-structures rely heavily on inheritance --- you can't have general-purpose data-structures without inheritance --- by forcing the base value to be 0, Pelc is effectively denying the possibility of inheritance.
> 
> Also, this is grossly inefficient code. It is a CREATE DOES> word, so a CALL is required. Also, it is fetching the offset from memory, but this is a constant that is known at compile-time so it should be a literal. Also, if this value is zero (it is for the first field) then it still gets fetch from memory and added, although this is not necessary. Also, Pelc is not aligning his fields and making their size a multiple of the cell size --- this boosts speed considerably on modern processors (everything after the 1980s) --- this is also required for my SORT to work (because EXCHANGE requires the element size to be a multiple of the cell size).

If I were to write a book on Forth, I would do it completely differently than Pelc did. I would not start right out by providing low-level code such as ARRAY and FIELD --- this is too complicated for a novice to understand because it involves meta-compiling --- and and idiots' version written with CREATE DOES> has serious problems that tend to make Forth look stupid to people who already know C or some other such language.

Instead, I would tell the reader to load the novice-package, and I would provide documentation on how to use the low-level code therein for writing application programs, but I would discourage the readers from delving into the internal workings of the low-level code until after they have written a few application programs and progressed to at least an intermediate level of Forth ability.

Pelc's own code tends to be horrible. Here is an example:
----------------------------------------------------------------------------
struct itimer   \ -- len 
\ *G Interval timer structure. 
\ *[ 
  cell field itlink                     \ link to next timer ; MUST be first 
  cell field itTimerId                        \ timer ID 
  cell field itinterval                 \ period of timer in MS 
  cell field ittimeout                  \ next timeout 
  cell field itmode                     \ mode/flags, 0=periodic, 1=one shot 
  cell field itxt                       \ word to execute 
end-struct 

: do-timers     \ -- ; process all the timers in the chain 
  active-timers @ 
  begin 
    dup 
   while                                \ -- struct 
    dup itlink @ swap                   \ get next in chain 
    dup ittimeout @  ticks - 0< if      \ if the interval has expired 
      dup itxt @ execute                \ run the word 
      dup itmode @ single-shot = if        \ if a single shot timer 
        release-timer                   \ dispose of the timer 
      else 
        dup itinterval @                \ update the timeout point 
        swap ittimeout +! 
      endif 
    else 
      drop 
    endif 
  repeat 
  drop                                  \ discard the end of chain 
; 
----------------------------------------------------------------------------

I would start out by teaching the reader how inheritance works. This is pretty basic computer-science and most readers are already going to know about inheritance, but I can still explain it in relation to Forth. I would explain how I have a LIST struct in LIST.4TH and I have words that work on lists, and how any struct that inherits from LIST will get to use all of it parent class's methods. For example, I can define this ITIMER struct as a child of the LIST struct:
----------------------------------------------------------------------------
list 
    w field .itTimerId 
    w field .itInterval 
    w field .itTimeOut 
    w field .itMode 
    w field .itXT 
constant itimer 
----------------------------------------------------------------------------

Then I can explain how the methods of LIST are available. One of those methods is EACH and here is an example of its use:

----------------------------------------------------------------------------
: do-timer { tim -- } 
    ticks tim .itTimeOut @  u>= if                             \ expired? 
        tim .itXT @ execute                                    \ no stack effect         
        tim itMode @  single-shot = if  tim release-timer       \ release it 
        else  tim .itInterval @  tim .itTimeOut +!  then      \ renew it 
    then ; 

: do-timers ( -- ) 
    active-timers @  ['] do-timer  each ; 
----------------------------------------------------------------------------

I can then explain how EACH has some performance issues, so if speed is very critical then a different technique can be used. But if this technique is used, then there are some issues to consider (debugging is more difficult; it is necessary to remember to not pass data into the loop on the return-stack). Here is an example:

----------------------------------------------------------------------------
: do-timers ( -- ) 
    active-timers @  each[ 
        ticks  over .itTimeOut @  u>= if                        \ expired? 
            dup .itXT @ execute                                 \ no stack effect 
            dup .itMode @  single-shot = if  dup release-timer  \ release it 
            else  dup .itInterval @  over .itTimeOut +!  then   \ renew it 
        then 
        drop  ]each ; 
----------------------------------------------------------------------------

I can explain that using the return-stack to hold data can improve readability, but it may degrade performance somewhat. This is because the x86 does CALL prediction up to 16 levels deep, but it won't do this when the return-stack is used for holding data, and consequently the code has to be JIT'd again when the RET executes because it hasn't been predicted. This is novice-level assembly-language, so most readers should already know this (it is discussed in Intel's book-2 discussing optimization), but I will explain it anyway. Here is another example that may be more readable but will suffer from this CALL-prediction failure issue:

----------------------------------------------------------------------------
: do-timers ( -- ) 
    active-timers @  each[  >r 
        ticks r@ .itTimeOut @  u>= if                             \ expired? 
            r@ .itXT @ execute                                    \ no stack effect         
            r@ itMode @  single-shot = if  r@ release-timer       \ release it 
            else  r@ .itInterval @  r@ .itTimeOut +!  then      \ renew it 
        then 
        rdrop  ]each ; 
----------------------------------------------------------------------------

So, this is how my book would progress. I would explain concepts, but I would not provide low-level code that the reader is not ready for, and which tends to be pretty tedious and boring for the reader --- examples would be, how arrays and lists are implemented --- I would instead provide examples of high-level code such as DOTIMERS above that use the low-level code. For the most part I would stick with pretty novice-level code that anybody who already knows C and/or x86 assembly-language should find to be pretty easy.

I would focus on explaining concepts, such as inheritance. These are pretty basic concepts that every reader should already know. I would explain these concepts in terms of Forth however, so the reader learns Forth within the context of familiar and not-very-challenging territory. Stephen Pelc wrote his book, but he never mentioned inheritance anywhere --- inheritance is pretty fundamental to programming though --- it should have been mentioned, and in fact should have been the focus of the book.

Here is a good title for the book: "ANS-Forth explained super-simple for dumb-head readers"

[toc] | [prev] | [next] | [standalone]


#49786 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

Fromrickman <gnuarm@gmail.com>
Date2016-08-04 09:35 -0400
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<nnvgao$uq$1@dont-email.me>
In reply to#49780
On 8/4/2016 3:41 AM, hughaguilar96@gmail.com wrote:
> On Wednesday, August 3, 2016 at 12:04:34 AM UTC-7,
> hughag...@gmail.com wrote:
>> Here is another example from Stephen Pelc's book:
>>
>> 0 constant [struct \ -- 0 ; start \ Start a structure definition,
>> returning zero as \ the initial offset. : field \ offset n --
>> offset+n ; addr -- addr+offset \ When defining a structure, a field
>> of size n starts \ at the given offset, returning the next offset.
>> At \ run time, the offset is added to the base address. create over
>> , + \ lay offset and update does> @ + \ addr offset to address ; :
>> struct] \ offset -- ; -- size ; end \ End a structure definition by
>> naming it. constant ;
>>
>> This is more horrible Forth code! Pelc says: "The first and third
>> words are just syntactic sugar to make the code easier to read."
>> This doesn't make the code easier to read however. This conceals
>> the fact that one struct can inherit from another struct.
>> General-purpose data-structures rely heavily on inheritance --- you
>> can't have general-purpose data-structures without inheritance ---
>> by forcing the base value to be 0, Pelc is effectively denying the
>> possibility of inheritance.
>>
>> Also, this is grossly inefficient code. It is a CREATE DOES> word,
>> so a CALL is required. Also, it is fetching the offset from memory,
>> but this is a constant that is known at compile-time so it should
>> be a literal. Also, if this value is zero (it is for the first
>> field) then it still gets fetch from memory and added, although
>> this is not necessary. Also, Pelc is not aligning his fields and
>> making their size a multiple of the cell size --- this boosts speed
>> considerably on modern processors (everything after the 1980s) ---
>> this is also required for my SORT to work (because EXCHANGE
>> requires the element size to be a multiple of the cell size).
>
> If I were to write a book on Forth, I would do it completely
> differently than Pelc did.

So what's stopping you?

> Here is a good title for the book: "ANS-Forth explained super-simple
> for dumb-head readers"

Maybe let someone else name it...

-- 

Rick C

[toc] | [prev] | [next] | [standalone]


#49789 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromCecil Bayona <cbayona@cbayona.com>
Date2016-08-04 10:08 -0500
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<nnvlpb$kdi$1@dont-email.me>
In reply to#49786
On 8/4/2016 8:35 AM, rickman wrote:
> On 8/4/2016 3:41 AM, hughaguilar96@gmail.com wrote:
>> On Wednesday, August 3, 2016 at 12:04:34 AM UTC-7,
>> hughag...@gmail.com wrote:
>>> Here is another example from Stephen Pelc's book:
>>>
>>> 0 constant [struct \ -- 0 ; start \ Start a structure definition,
>>> returning zero as \ the initial offset. : field \ offset n --
>>> offset+n ; addr -- addr+offset \ When defining a structure, a field
>>> of size n starts \ at the given offset, returning the next offset.
>>> At \ run time, the offset is added to the base address. create over
>>> , + \ lay offset and update does> @ + \ addr offset to address ; :
>>> struct] \ offset -- ; -- size ; end \ End a structure definition by
>>> naming it. constant ;
>>>
>>> This is more horrible Forth code! Pelc says: "The first and third
>>> words are just syntactic sugar to make the code easier to read."
>>> This doesn't make the code easier to read however. This conceals
>>> the fact that one struct can inherit from another struct.
>>> General-purpose data-structures rely heavily on inheritance --- you
>>> can't have general-purpose data-structures without inheritance ---
>>> by forcing the base value to be 0, Pelc is effectively denying the
>>> possibility of inheritance.
>>>
>>> Also, this is grossly inefficient code. It is a CREATE DOES> word,
>>> so a CALL is required. Also, it is fetching the offset from memory,
>>> but this is a constant that is known at compile-time so it should
>>> be a literal. Also, if this value is zero (it is for the first
>>> field) then it still gets fetch from memory and added, although
>>> this is not necessary. Also, Pelc is not aligning his fields and
>>> making their size a multiple of the cell size --- this boosts speed
>>> considerably on modern processors (everything after the 1980s) ---
>>> this is also required for my SORT to work (because EXCHANGE
>>> requires the element size to be a multiple of the cell size).
>>
>> If I were to write a book on Forth, I would do it completely
>> differently than Pelc did.
>
> So what's stopping you?
>
>> Here is a good title for the book: "ANS-Forth explained super-simple
>> for dumb-head readers"
>
> Maybe let someone else name it...
>

"ANS Forth a guide to alternate realities" that way people on all sides 
of the arguments can choose their own meaning to that title.

-- 
Cecil - k5nwa

[toc] | [prev] | [next] | [standalone]


#49752

FromBrad Eckert <hwfwguy@gmail.com>
Date2016-08-02 15:45 -0700
Message-ID<3e1d7770-f26a-4ee8-a1b1-d08ab3768a2b@googlegroups.com>
In reply to#49737
On Tuesday, August 2, 2016 at 9:33:47 AM UTC-7, JUERGEN wrote:
> It took longer than expected, but as Stephen allowed me to reformat his book for publication on amazon, it had to be finished - came out today https://www.amazon.co.uk/dp/B01JIWVB5S  or your local amazon.

No hard copy? It looks like my tree-killing days are numbered.

[toc] | [prev] | [next] | [standalone]


#49753 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromCecil Bayona <cbayona@cbayona.com>
Date2016-08-02 19:56 -0500
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<nnrffg$rgg$1@dont-email.me>
In reply to#49752
I have an extensive library on electronics, programming, and ham radio, 
but the last few years I buy a Kindle version when possible. When not 
available I buy a used hardbound copy if possible. I bought six books 
today, five were programming books in Kindle versions, one was a old 
hardbound book on Forth for $3.99 including shipping.

On 8/2/2016 5:45 PM, Brad Eckert wrote:
> On Tuesday, August 2, 2016 at 9:33:47 AM UTC-7, JUERGEN wrote:
>> It took longer than expected, but as Stephen allowed me to reformat his book for publication on amazon, it had to be finished - came out today https://www.amazon.co.uk/dp/B01JIWVB5S  or your local amazon.
>
> No hard copy? It looks like my tree-killing days are numbered.
>

-- 
Cecil - k5nwa

[toc] | [prev] | [next] | [standalone]


#49754 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromJUERGEN <epldfpga@aol.com>
Date2016-08-02 22:43 -0700
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<b1dab958-18c7-4603-b484-a856e97b0a39@googlegroups.com>
In reply to#49753
On Wednesday, August 3, 2016 at 1:56:17 AM UTC+1, Cecil - k5nwa wrote:
> I have an extensive library on electronics, programming, and ham radio, 
> but the last few years I buy a Kindle version when possible. When not 
> available I buy a used hardbound copy if possible. I bought six books 
> today, five were programming books in Kindle versions, one was a old 
> hardbound book on Forth for $3.99 including shipping.
> 
> On 8/2/2016 5:45 PM, Brad Eckert wrote:
> > On Tuesday, August 2, 2016 at 9:33:47 AM UTC-7, JUERGEN wrote:
> >> It took longer than expected, but as Stephen allowed me to reformat his book for publication on amazon, it had to be finished - came out today https://www.amazon.co.uk/dp/B01JIWVB5S  or your local amazon.
> >
> > No hard copy? It looks like my tree-killing days are numbered.
> >
> 
> -- 
> Cecil - k5nwa

Until now I preferred eBooks, as of lower cost or free. But with books like this one and as formatting is uncontrollable unfortunately, a printed version is under consideration - but cannot be read on mobile or tablet. So the usual swings and roundabouts.

[toc] | [prev] | [next] | [standalone]


#49758 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

Fromhughaguilar96@gmail.com
Date2016-08-03 00:12 -0700
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<ab49f1b1-7e52-4e5f-8519-e87bbcfb113a@googlegroups.com>
In reply to#49753
On Tuesday, August 2, 2016 at 5:56:17 PM UTC-7, Cecil - k5nwa wrote:
> I have an extensive library on electronics, programming, and ham radio, 
> but the last few years I buy a Kindle version when possible. When not 
> available I buy a used hardbound copy if possible. I bought six books 
> today, five were programming books in Kindle versions, one was a old 
> hardbound book on Forth for $3.99 including shipping.

The only hard-bound book on Forth that I'm aware of was: "Threaded Interpretive Languages" (R.G.Loeliger). Is this the one that you mean? It is a pretty good book --- I read that when I was 18 years old and still in high-school --- then I lent it to a guy out at the college and he moved away without returning it.

[toc] | [prev] | [next] | [standalone]


#49760 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromCecil Bayona <cbayona@cbayona.com>
Date2016-08-03 02:42 -0500
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<nns79a$17q$1@dont-email.me>
In reply to#49758

On 8/3/2016 2:12 AM, hughaguilar96@gmail.com wrote:
> On Tuesday, August 2, 2016 at 5:56:17 PM UTC-7, Cecil - k5nwa wrote:
>> I have an extensive library on electronics, programming, and ham radio,
>> but the last few years I buy a Kindle version when possible. When not
>> available I buy a used hardbound copy if possible. I bought six books
>> today, five were programming books in Kindle versions, one was a old
>> hardbound book on Forth for $3.99 including shipping.
>
> The only hard-bound book on Forth that I'm aware of was: "Threaded Interpretive Languages" (R.G.Loeliger). Is this the one that you mean? It is a pretty good book --- I read that when I was 18 years old and still in high-school --- then I lent it to a guy out at the college and he moved away without returning it.
>
I bought today a hard cover book on Forth, below that one are several 
other Hardcover Forth books;

  "Forth: The New Model : A Programmer's Handbook/Book and Disk", can't 
tell you anything about it, it's a pig in a poke, it was cheap and never 
heard of it so I took a chance and bought it.

"Embedded Controller Forth For The 8051 Family" is also a hardback book 
but it is outrageously priced.

"Forth Tools and Applications" is another hardback book on Forth. $39

"Forth: The Fourth-Generation Language" $1539.03, insane price.

"Forth for Professionals: A Practical Programming Language for Research 
and Development" $1941.21, these people are insane.

"FORTH: a Complete Course in the Forth Programming Language", $50
-- 
Cecil - k5nwa

[toc] | [prev] | [next] | [standalone]


#49766 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

Fromhughaguilar96@gmail.com
Date2016-08-03 10:41 -0700
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<abb7be50-46b8-492f-adba-04bcc1fe5af7@googlegroups.com>
In reply to#49760
On Wednesday, August 3, 2016 at 12:42:36 AM UTC-7, Cecil - k5nwa wrote:
> On 8/3/2016 2:12 AM, hughaguilar96@gmail.com wrote:
> > On Tuesday, August 2, 2016 at 5:56:17 PM UTC-7, Cecil - k5nwa wrote:
> >> I have an extensive library on electronics, programming, and ham radio,
> >> but the last few years I buy a Kindle version when possible. When not
> >> available I buy a used hardbound copy if possible. I bought six books
> >> today, five were programming books in Kindle versions, one was a old
> >> hardbound book on Forth for $3.99 including shipping.
> >
> > The only hard-bound book on Forth that I'm aware of was: "Threaded Interpretive Languages" (R.G.Loeliger). Is this the one that you mean? It is a pretty good book --- I read that when I was 18 years old and still in high-school --- then I lent it to a guy out at the college and he moved away without returning it.
> >
> I bought today a hard cover book on Forth, below that one are several 
> other Hardcover Forth books;
> 
>   "Forth: The New Model : A Programmer's Handbook/Book and Disk", can't 
> tell you anything about it, it's a pig in a poke, it was cheap and never 
> heard of it so I took a chance and bought it.
> 
> "Embedded Controller Forth For The 8051 Family" is also a hardback book 
> but it is outrageously priced.
> 
> "Forth Tools and Applications" is another hardback book on Forth. $39
> 
> "Forth: The Fourth-Generation Language" $1539.03, insane price.
> 
> "Forth for Professionals: A Practical Programming Language for Research 
> and Development" $1941.21, these people are insane.
> 
> "FORTH: a Complete Course in the Forth Programming Language", $50
> -- 
> Cecil - k5nwa

Actually, now that I think about it, there were some other Forth books that made it into hard-cover. I have "Embedded Controller Forth For The 8051 Family" --- that book consists almost entirely of 8051 assembly-language source-code with very little text --- I don't know why it was made into a book rather than distributed on disk (who is going to type all of that in?).

There is also Dick Pountain's book: "Object Oriented Forth" that was hard-cover and which I also have --- I didn't like his OOP system, but I don't remember why now, as that was 30 years ago when I read his book --- I have a super-simple OOP system in the novice-package that works well for me.

[toc] | [prev] | [next] | [standalone]


#49768 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromCecil Bayona <cbayona@cbayona.com>
Date2016-08-03 12:56 -0500
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<nntb7v$p0g$1@dont-email.me>
In reply to#49766

On 8/3/2016 12:41 PM, hughaguilar96@gmail.com wrote:
> On Wednesday, August 3, 2016 at 12:42:36 AM UTC-7, Cecil - k5nwa wrote:
>> On 8/3/2016 2:12 AM, hughaguilar96@gmail.com wrote:
>>> On Tuesday, August 2, 2016 at 5:56:17 PM UTC-7, Cecil - k5nwa wrote:
>>>> I have an extensive library on electronics, programming, and ham radio,
>>>> but the last few years I buy a Kindle version when possible. When not
>>>> available I buy a used hardbound copy if possible. I bought six books
>>>> today, five were programming books in Kindle versions, one was a old
>>>> hardbound book on Forth for $3.99 including shipping.
>>>
>>> The only hard-bound book on Forth that I'm aware of was: "Threaded Interpretive Languages" (R.G.Loeliger). Is this the one that you mean? It is a pretty good book --- I read that when I was 18 years old and still in high-school --- then I lent it to a guy out at the college and he moved away without returning it.
>>>
>> I bought today a hard cover book on Forth, below that one are several
>> other Hardcover Forth books;
>>
>>   "Forth: The New Model : A Programmer's Handbook/Book and Disk", can't
>> tell you anything about it, it's a pig in a poke, it was cheap and never
>> heard of it so I took a chance and bought it.
>>
>> "Embedded Controller Forth For The 8051 Family" is also a hardback book
>> but it is outrageously priced.
>>
>> "Forth Tools and Applications" is another hardback book on Forth. $39
>>
>> "Forth: The Fourth-Generation Language" $1539.03, insane price.
>>
>> "Forth for Professionals: A Practical Programming Language for Research
>> and Development" $1941.21, these people are insane.
>>
>> "FORTH: a Complete Course in the Forth Programming Language", $50
>> --
>> Cecil - k5nwa
>
> Actually, now that I think about it, there were some other Forth books that made it into hard-cover. I have "Embedded Controller Forth For The 8051 Family" --- that book consists almost entirely of 8051 assembly-language source-code with very little text --- I don't know why it was made into a book rather than distributed on disk (who is going to type all of that in?).
>
> There is also Dick Pountain's book: "Object Oriented Forth" that was hard-cover and which I also have --- I didn't like his OOP system, but I don't remember why now, as that was 30 years ago when I read his book --- I have a super-simple OOP system in the novice-package that works well for me.
>
The embedded book for 8051 is $54 for a used copy, too much if it 
doesn't include the listing as a readable file somewhere.

The list I provided are all found in Hard Binding, but those are the 
ones found on Amazon, there could be others, there was a surprising 
number of books in paperback form, which surprised me as I only expected 
about 1/2 a dozen or so. Most were way overpriced for old used books and 
two of them are insane with a price over $1500 for a used book, they 
must be working on the theory that that some idiots have more money than 
sense.

-- 
Cecil - k5nwa

[toc] | [prev] | [next] | [standalone]


#49771 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromCecil Bayona <cbayona@cbayona.com>
Date2016-08-03 13:09 -0500
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<nntc0e$rqv$1@dont-email.me>
In reply to#49766

On 8/3/2016 12:41 PM, hughaguilar96@gmail.com wrote:
> On Wednesday, August 3, 2016 at 12:42:36 AM UTC-7, Cecil - k5nwa wrote:
>> On 8/3/2016 2:12 AM, hughaguilar96@gmail.com wrote:
>>> On Tuesday, August 2, 2016 at 5:56:17 PM UTC-7, Cecil - k5nwa wrote:
>>>> I have an extensive library on electronics, programming, and ham radio,
>>>> but the last few years I buy a Kindle version when possible. When not
>>>> available I buy a used hardbound copy if possible. I bought six books
>>>> today, five were programming books in Kindle versions, one was a old
>>>> hardbound book on Forth for $3.99 including shipping.
>>>
>>> The only hard-bound book on Forth that I'm aware of was: "Threaded Interpretive Languages" (R.G.Loeliger). Is this the one that you mean? It is a pretty good book --- I read that when I was 18 years old and still in high-school --- then I lent it to a guy out at the college and he moved away without returning it.
>>>
>> I bought today a hard cover book on Forth, below that one are several
>> other Hardcover Forth books;
>>
>>   "Forth: The New Model : A Programmer's Handbook/Book and Disk", can't
>> tell you anything about it, it's a pig in a poke, it was cheap and never
>> heard of it so I took a chance and bought it.
>>
>> "Embedded Controller Forth For The 8051 Family" is also a hardback book
>> but it is outrageously priced.
>>
>> "Forth Tools and Applications" is another hardback book on Forth. $39
>>
>> "Forth: The Fourth-Generation Language" $1539.03, insane price.
>>
>> "Forth for Professionals: A Practical Programming Language for Research
>> and Development" $1941.21, these people are insane.
>>
>> "FORTH: a Complete Course in the Forth Programming Language", $50
>> --
>> Cecil - k5nwa
>
> Actually, now that I think about it, there were some other Forth books that made it into hard-cover. I have "Embedded Controller Forth For The 8051 Family" --- that book consists almost entirely of 8051 assembly-language source-code with very little text --- I don't know why it was made into a book rather than distributed on disk (who is going to type all of that in?).
>
> There is also Dick Pountain's book: "Object Oriented Forth" that was hard-cover and which I also have --- I didn't like his OOP system, but I don't remember why now, as that was 30 years ago when I read his book --- I have a super-simple OOP system in the novice-package that works well for me.
>
Found another one;

"FORTH: Applications in Engineering and Industry" $2.63 + shipping, I 
bought it, it was cheap, most likely quite useless.

-- 
Cecil - k5nwa

[toc] | [prev] | [next] | [standalone]


#49772 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

Fromrickman <gnuarm@gmail.com>
Date2016-08-03 14:15 -0400
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<nntcbq$ss3$1@dont-email.me>
In reply to#49771
On 8/3/2016 2:09 PM, Cecil Bayona wrote:
>
>
> On 8/3/2016 12:41 PM, hughaguilar96@gmail.com wrote:
>> On Wednesday, August 3, 2016 at 12:42:36 AM UTC-7, Cecil - k5nwa wrote:
>>> On 8/3/2016 2:12 AM, hughaguilar96@gmail.com wrote:
>>>> On Tuesday, August 2, 2016 at 5:56:17 PM UTC-7, Cecil - k5nwa wrote:
>>>>> I have an extensive library on electronics, programming, and ham
>>>>> radio,
>>>>> but the last few years I buy a Kindle version when possible. When not
>>>>> available I buy a used hardbound copy if possible. I bought six books
>>>>> today, five were programming books in Kindle versions, one was a old
>>>>> hardbound book on Forth for $3.99 including shipping.
>>>>
>>>> The only hard-bound book on Forth that I'm aware of was: "Threaded
>>>> Interpretive Languages" (R.G.Loeliger). Is this the one that you
>>>> mean? It is a pretty good book --- I read that when I was 18 years
>>>> old and still in high-school --- then I lent it to a guy out at the
>>>> college and he moved away without returning it.
>>>>
>>> I bought today a hard cover book on Forth, below that one are several
>>> other Hardcover Forth books;
>>>
>>>   "Forth: The New Model : A Programmer's Handbook/Book and Disk", can't
>>> tell you anything about it, it's a pig in a poke, it was cheap and never
>>> heard of it so I took a chance and bought it.
>>>
>>> "Embedded Controller Forth For The 8051 Family" is also a hardback book
>>> but it is outrageously priced.
>>>
>>> "Forth Tools and Applications" is another hardback book on Forth. $39
>>>
>>> "Forth: The Fourth-Generation Language" $1539.03, insane price.
>>>
>>> "Forth for Professionals: A Practical Programming Language for Research
>>> and Development" $1941.21, these people are insane.
>>>
>>> "FORTH: a Complete Course in the Forth Programming Language", $50
>>> --
>>> Cecil - k5nwa
>>
>> Actually, now that I think about it, there were some other Forth books
>> that made it into hard-cover. I have "Embedded Controller Forth For
>> The 8051 Family" --- that book consists almost entirely of 8051
>> assembly-language source-code with very little text --- I don't know
>> why it was made into a book rather than distributed on disk (who is
>> going to type all of that in?).
>>
>> There is also Dick Pountain's book: "Object Oriented Forth" that was
>> hard-cover and which I also have --- I didn't like his OOP system, but
>> I don't remember why now, as that was 30 years ago when I read his
>> book --- I have a super-simple OOP system in the novice-package that
>> works well for me.
>>
> Found another one;
>
> "FORTH: Applications in Engineering and Industry" $2.63 + shipping, I
> bought it, it was cheap, most likely quite useless.

Back in the day I bought a couple/three Forth books.  They turned out to 
be pretty lame for the most part.  I think the good ones are written by 
the more commercial elements represented here.  They have a strong 
motivation to produce quality training materials.

-- 

Rick C

[toc] | [prev] | [next] | [standalone]


#49777 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromRichard Owlett <rowlett@cloud85.net>
Date2016-08-03 18:00 -0500
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<WI-dnZB-d-kG6j_KnZ2dnUU7-Y-dnZ2d@supernews.com>
In reply to#49772
On 8/3/2016 1:15 PM, rickman wrote:
>
> Back in the day I bought a couple/three Forth books.  They turned
> out to be pretty lame for the most part.  I think the good ones
> are written by the more commercial elements represented here.
> They have a strong motivation to produce quality training materials.
>

When I first tried Forth I went commercial just for that reason. 
I needed the comfort factor.

[toc] | [prev] | [next] | [standalone]


#49806 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

Fromhughaguilar96@gmail.com
Date2016-08-05 20:35 -0700
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<6d4e631e-cd0f-4628-8dca-f04ec462723a@googlegroups.com>
In reply to#49777
On Wednesday, August 3, 2016 at 4:00:48 PM UTC-7, Richard Owlett wrote:
> On 8/3/2016 1:15 PM, rickman wrote:
> >
> > Back in the day I bought a couple/three Forth books.  They turned
> > out to be pretty lame for the most part.  I think the good ones
> > are written by the more commercial elements represented here.
> > They have a strong motivation to produce quality training materials.
> >
> 
> When I first tried Forth I went commercial just for that reason. 
> I needed the comfort factor.

No Forth Inc. book has ever described how to implement structs in Forth (the FIELD definer) and no Forth Inc. book ever will. Stephen Pelc's book discussed in this thread does provide this code:
----------------------------------------------------------------------------
0 constant [struct \ -- 0 ; start 
\ Start a structure definition, returning zero as 
\ the initial offset. 
: field \ offset n -- offset+n ; addr -- addr+offset 
\ When defining a structure, a field of size n starts 
\ at the given offset, returning the next offset. At 
\ run time, the offset is added to the base address. 
 create 
 over , + \ lay offset and update 
 does> 
 @ + \ addr offset to address 
; 
: struct] \ offset -- ; -- size ; end 
\ End a structure definition by naming it. 
 constant 
; 
----------------------------------------------------------------------------
The FIELD words are grossly inefficient because they are defined with CREATE DOES> --- this was fine with Stephen Pelc because he didn't expect anybody to actually use this code --- he wanted to tell people that the use of structs results in inefficient programs, so he purposely made FIELD generate inefficient code.

The worst thing about this code however, is that the [STRUCT word forces the starting offset to be zero. Pelc did this because he wanted to conceal the fact that a struct can inherit from another struct. Most likely, Pelc's background is in C programming, and C forces the starting offset to be zero, so Pelc felt obliged to impose the same limitation on Forth. Pelc's attempt at limiting Forth doesn't actually work though --- Forth is flexible and the Forth programmer can work around these imposed limitations simply by not using [STRUCT --- by comparison, C is inflexible and there is no way for the C programmer to work around these imposed limitations.

Inheritance is a totally taboo subject for the Forth-200x committee (all of whom were appointed to the committee by Elizabeth Rather) --- the Forth-200x committee will do everything in their power to deny the possibility of a child struct inheriting from a parent struct --- this is the key to implementing general-purpose data-structures, which Elizabeth Rather is dead-set opposed to. She said this about my general-purpose data-structures in the novice-package:
----------------------------------------------------------------------------
Does "*every* application" you write use exactly the same kind of data arranged in the same way? If so, having written it once you can reuse it often. If not, you either have to rearrange your data to make it work or modify your "general-purpose" structure.
----------------------------------------------------------------------------

I like Cecil's suggestion for a title to my book: "ANS Forth --- a guide to alternate realities." With a title like that, I would be guaranteed to have exactly zero readers! Who cares about alternate realities? Nobody!

This reminds me of how a lot of people will say that they have an open mind regarding ghosts and discorporal spirits, but in the next breath they will say that they have never seen such a thing and have no expectation that they ever will see such a thing, and they believe that anybody who claims to have seen such a thing is an attention-seeking liar who belongs in a psychiatric hospital. Check out this video:
https://www.youtube.com/watch?v=PfAmEgEjsH0
When people see this video, they typically offer one of the following explanations:
1.) They didn't see any orb. There was no flying orb, there were just the two people; anybody who sees an orb in the video is hallucinating.
2.) The orb was ball lightning. They don't have a definition for the term "ball lightning," but they are sure that scientists do have a definition because it is such a sciency sounding term.
3.) The video was faked. Digital video is composed of pixels that can be modified with PhotoShop or similar software --- the preacher guy most likely paid some graphics-artist to fake up the video in an effort to get people to come to his ministry and donate money.
4.) They didn't watch the video. They saw the title, "Angel Visitation," so they knew immediately that the video was hogwash, and they don't have 30 seconds to spare in their busy schedule for hogwash, so they just didn't watch the video.

The same thing is true of general-purpose data-structures in Forth. I use inheritance routinely throughout the novice-package to implement general-purpose data-structures in ANS-Forth. For example, I have the LIST struct that provides a singly-linked list data-structure, and I have several structs (such as SEQ) that inherit from LIST, and I also have structs that inherit from these structs. Everybody just refuses to look at this; they either say that it doesn't exist, or they say that it does exist but it is "crap." It is a taboo subject! No ANS-Forth programmer will ever admit that general-purpose data-structures exist. Consider this thread:
https://groups.google.com/forum/#!topic/comp.lang.forth/ohE8mx7tWQU%5B126-150%5D
When I provided my hottie-counting function, that killed the thread --- I showed an impossibility! --- nobody wanted to post on the thread anymore because the thread had been tainted with taboo code.

If I wrote a book about general-purpose data-structures in ANS-Forth, nobody would read it. People want to stay within their comfort zone (see Richard Owlett's comment quoted at the top of this post) --- this means that all ANS-Forth code has to rely entirely on cut-and-paste-and-modify of existing programs --- the use of code-libraries is absolutely forbidden!

[toc] | [prev] | [next] | [standalone]


#49808 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

FromCecil Bayona <cbayona@cbayona.com>
Date2016-08-06 00:16 -0500
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<no3rqm$b04$1@dont-email.me>
In reply to#49806

On 8/5/2016 10:35 PM, hughaguilar96@gmail.com wrote:
> On Wednesday, August 3, 2016 at 4:00:48 PM UTC-7, Richard Owlett wrote:

> ----------------------------------------------------------------------------
>
> I like Cecil's suggestion for a title to my book: "ANS Forth --- a guide to alternate realities." With a title like that, I would be guaranteed to have exactly zero readers! Who cares about alternate realities? Nobody!
>
> If I wrote a book about general-purpose data-structures in ANS-Forth, nobody would read it. People want to stay within their comfort zone (see Richard Owlett's comment quoted at the top of this post) --- this means that all ANS-Forth code has to rely entirely on cut-and-paste-and-modify of existing programs --- the use of code-libraries is absolutely forbidden!
>
LOL... I said the title allowed people with different opinions to have 
their opinions validated, some people would take it as ANS Forth is an 
alternate reality, not based on substance, others would take what you 
and others say about Forth as an alternate reality, it's a Politically 
Correct title, it makes everyone happy but it's totally without meaning.

A long time ago I started using Borland Delphi for writing work related 
and personal software but I could not afford the horribly expensive 
database capable version at the time. I ended writing my own Self 
Balancing B-Tree multi key database library, it was complex to figure it 
out, and it took me a while to get it right, but once it was working I 
would use it all over the place. It was very fast, it took little space, 
and was very flexible so for years I used it for all sorts of tools and 
applications. Yet when I mentioned on this list that it would be nice to 
have a library with the much simpler link list, you would have thought I 
said that babies should be starved, and burned alive, some people were 
all over me criticizing my desire for a convenient link list in a 
library, after all Forth itself uses linked list.

The moral here is PC should be flushed down the toilet like the other 
items in the toilet,  I will have my libraries of items that are 
generally useful, no way anyone is going to convince me to write a Self 
Balancing B-Tree multi key database or a MySQL interface every time I 
need it, it will be waiting in a library ready to use. To that end I 
found my source code in Pascal on 3.5" floppies, and a printed listing, 
and will look to see if it's feasible to translate it to Forth if so I 
need to buy a 3.5" floppy drive, I have 15 PCs including several 
laptops, and not one of them has a floppy drive to read the source.

I also have been looking to see if anyone in the past has created a 
decent library system, which is another item that is considered heresy 
in the Forth community here, yet ANS Forth uses primitive libraries but 
most won't admit it, they are called word sets. Recently I saw a post on 
ideas for a library system where  you can have public and private words, 
I will be looking at it next week and see if the ideas are useful for 
what I need.
-- 
Cecil - k5nwa

[toc] | [prev] | [next] | [standalone]


#49822 — Re: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc

Fromhughaguilar96@gmail.com
Date2016-08-06 16:58 -0700
SubjectRe: The Fourth Forth eBook in our little series - Programming Forth - Stephen Pelc
Message-ID<b2dc5b08-64c0-4cb9-af70-b9f8dd9dc17c@googlegroups.com>
In reply to#49808
On Friday, August 5, 2016 at 10:16:08 PM UTC-7, Cecil - k5nwa wrote:
> A long time ago I started using Borland Delphi for writing work related 
> and personal software but I could not afford the horribly expensive 
> database capable version at the time. I ended writing my own Self 
> Balancing B-Tree multi key database library, it was complex to figure it 
> out, and it took me a while to get it right, but once it was working I 
> would use it all over the place. It was very fast, it took little space, 
> and was very flexible so for years I used it for all sorts of tools and 
> applications. Yet when I mentioned on this list that it would be nice to 
> have a library with the much simpler link list, you would have thought I 
> said that babies should be starved, and burned alive, some people were 
> all over me criticizing my desire for a convenient link list in a 
> library, after all Forth itself uses linked list.

If you get your self-balancing B-Tree to work, I will put it in the novice-package --- that way you can be sure that nobody will ever use it! --- everything in the novice-package automatically gets dismissed as "crap" by the committee...

I am not aware of any other language in which code-libraries are forbidden. Languages have various levels of support for code-libraries, and the better support the language has, the better the language is. Nobody forbids code-libraries though, other than the ANS-Forth and Forth-200x committees (and COBOL too).

What is sad about this, is that Forth has better support for code-libraries than C does. In C, a struct has to start on offset zero. If the parent struct is made into the first field of the child struct, this won't work because now you need to doubly dereference the field names (use two -> or two . operators). Of course, if you have a struct inheriting from a struct which inherits from another struct, then you have to triply dereference the field names. If you typecast your pointer to the parent struct, you can avoid multiple dereferencing of the field names, but now SIZEOF doesn't work correctly anymore because it gives the parent size rather than the child size. All in all, inheritance in C is a nightmare. By comparison, inheritance in Forth is easy --- yet ANS-Forth culture absolutely forbids having structs inherit from each other --- Pelc went out of his way to give us STRUCT[ which has no purpose at all except to force the starting offset to be zero and hence to make Forth look like C along with C's restrictions against inheritance.

If Forth would embrace inheritance and general-purpose data-structures, this would give Forth an obvious advantage over C --- but the Forth-200x committee seem to be dedicated to imposing C's restrictions on Forth --- the Forth-200x committee wants Forth to be an RPN version of C, with no distinction between Forth and C except postfix-versus-infix (which is really meaningless).

> The moral here is PC should be flushed down the toilet like the other 
> items in the toilet,  I will have my libraries of items that are 
> generally useful, no way anyone is going to convince me to write a Self 
> Balancing B-Tree multi key database or a MySQL interface every time I 
> need it, it will be waiting in a library ready to use. To that end I 
> found my source code in Pascal on 3.5" floppies, and a printed listing, 
> and will look to see if it's feasible to translate it to Forth if so I 
> need to buy a 3.5" floppy drive, I have 15 PCs including several 
> laptops, and not one of them has a floppy drive to read the source.

There are media copying centers available --- you can go there to get obsolete media copied to modern media --- I did that in Denver and it only cost a few dollars (I don't recall now what media format I was getting upgraded, but it was obsolete and yet they did it without difficulty).

> I also have been looking to see if anyone in the past has created a 
> decent library system, which is another item that is considered heresy 
> in the Forth community here, yet ANS Forth uses primitive libraries but 
> most won't admit it, they are called word sets. Recently I saw a post on 
> ideas for a library system where  you can have public and private words, 
> I will be looking at it next week and see if the ideas are useful for 
> what I need.

As I mentioned in that thread, I had this working under UR/Forth 30 years ago, but I had to delve into UR/Forth internal workings, so my code wasn't Forth-83.

There has been no improvement in ANS-Forth --- this is still banned, but you may be able to get it working for a specific compiler by delving into the internal workings of that compiler.

What is sad about this, is that it is trivial to implement --- most of the time is spent in disassembling the compiler to figure out how dictionary headers are stored internally --- if you have this info though (the compiler-writer obviously does) then the implementation is the work of one hour or less.

This was banned from ANS-Forth specifically for the purpose of making code-libraries difficult to implement --- you end up with a lot of name clashes --- this makes the code-library less useful, proving the point of those you say that code-libraries are taboo.

[toc] | [prev] | [next] | [standalone]


Page 1 of 5  [1] 2 3 4 5  Next page →

Back to top | Article view | comp.lang.forth


csiph-web