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


Groups > comp.lang.forth > #24779

Re: Request for comments on a first forth program

Newsgroups comp.lang.forth
Date 2013-07-24 20:00 -0700
References <87wqomga80.fsf@pestilenz.org> <26e3733d-d76f-4a4a-8b30-0f888f9bb318@googlegroups.com> <ksbqgt$jgh$1@dont-email.me> <87txjpjais.fsf@necronomicon.my.domain> <2013Jul22.174305@mips.complang.tuwien.ac.at>
Message-ID <f2ba9703-0fec-42bf-a25a-d56ab5cc089d@googlegroups.com> (permalink)
Subject Re: Request for comments on a first forth program
From hughaguilar96@yahoo.com

Show all headers | View raw


On Monday, July 22, 2013 8:43:05 AM UTC-7, Anton Ertl wrote:
> Christian Kellermann <ckeen@necronomicon.my.domain> writes:
> >rickman <gnuarm@gmail.com> writes:
> >> Another tenet of Forth programming is to thoroughly test your words
> >> before using them.  It can be a lot of work to test each word
> >> separately, but this can save you lots of debug time chasing errors
> >> like forgetting to restore the return stack which will cause aborts
> >> and even crashes rather than just program errors.
> 
> >This is actually how I wrote this. I jotted down the steps I would need
> >to do on paper, then implemented each of them as I went switching
> >between a running forth and my editor copying working words over.

> The way I usually work is to write the Forth words and the test code
> in the editor and then run
> 
> gforth code.fs -e bye
> 
> whenever I feel like testing.  You can do it for every word if you want.

In my novice package I have a word TRY. You are expected to put a MARKER at the front of your file, with the name of the file. For example, if your file is called ROBOT.4TH then put this at the front of the file:

MARKER ROBOT.4TH

You can do this interactively:

TRY ROBOT.4TH

If ROBOT.4TH is already included, the code gets deleted. In either case, ROBOT.4TH is given to INCLUDE at this time. This works a lot better than manually doing this:
INCLUDE ROBOT.4TH
Doing this would result in a lot of redefinition warnings, which is quite annoying --- also, you will eventually run out of memory.

As I said before, you should not initialize data-structures when defining them. You should have a word INIT that initializes everything. If you don't want to do a TRY and recompile the code (because you haven't changed the source-code), you can just do an INIT and run it again.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-19 11:39 +0200
  Re: Request for comments on a first forth program Ron Aaron <rambamist@gmail.com> - 2013-07-19 13:04 +0300
    Re: Request for comments on a first forth program rickman <gnuarm@gmail.com> - 2013-07-19 12:43 -0400
  Re: Request for comments on a first forth program Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-19 05:28 -0500
  Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-19 03:56 -0700
    Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-19 04:00 -0700
    Re: Request for comments on a first forth program rickman <gnuarm@gmail.com> - 2013-07-19 12:51 -0400
      Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:28 +0200
        Re: Request for comments on a first forth program anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 15:43 +0000
          Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-24 20:00 -0700
            Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-25 10:37 +0200
              Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-26 00:00 -0700
                Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-26 09:34 +0200
                Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-25 21:40 -1000
                Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-27 20:16 -0700
                Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-29 10:09 +0200
                Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-29 04:14 -0700
                Re: Request for comments on a first forth program Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 07:49 -0500
                Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-29 15:32 -1000
                Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-31 17:50 -0700
                Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-31 13:23 +0200
                Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-31 18:05 -0700
                Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-08-01 12:53 +0200
                Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-08-01 09:58 -0500
                Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-08-01 20:42 -0700
                Re: Request for comments on a first forth program Brad Eckert <hwfwguy@gmail.com> - 2013-08-04 18:53 -0700
                Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-08-04 22:05 -0500
                Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-08-04 20:54 -0700
                Re: Request for comments on a first forth program Alex McDonald <blog@rivadpm.com> - 2013-08-05 05:50 -0700
                Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-08-05 22:14 +0200
                Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-08-06 21:11 -0700
                Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-08-01 01:04 -0500
    Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-19 18:06 +0000
      Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:31 +0200
    Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:24 +0200
      Re: Request for comments on a first forth program anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 15:32 +0000
  Re: Request for comments on a first forth program Alex McDonald <blog@rivadpm.com> - 2013-07-19 06:49 -0700
    Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:34 +0200
  Re: Request for comments on a first forth program Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-19 07:19 -0700
    Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:41 +0200
  Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-19 07:55 -1000
    Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:47 +0200
      Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-20 11:15 -1000
    Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-20 20:09 -0700
  Re: Request for comments on a first forth program "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2013-07-19 19:36 +0100
    Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-20 12:36 +0000
      Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:53 +0200
      Re: Request for comments on a first forth program Coos Haak <chforth@hccnet.nl> - 2013-07-21 02:02 +0200
        Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-20 17:18 -1000
      Re: Request for comments on a first forth program Ian Osgood <iano@quirkster.com> - 2013-07-23 16:07 -0700
    Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:48 +0200
  Re: Request for comments on a first forth program stephenXXX@mpeforth.com (Stephen Pelc) - 2013-07-20 12:18 +0000
    Re: Request for comments on a first forth program Christian Kellermann <ckeen@necronomicon.my.domain> - 2013-07-20 21:57 +0200
      Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-20 11:24 -1000
    Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-22 15:53 +0200
      Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-22 08:06 -0700
        Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-22 19:35 +0000
          Re: Request for comments on a first forth program m.a.m.hendrix@tue.nl - 2013-07-23 00:41 -0700
          Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-23 12:00 +0200
            Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-23 12:10 +0000
              Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-23 14:19 +0200
              Re: Request for comments on a first forth program stephenXXX@mpeforth.com (Stephen Pelc) - 2013-07-24 09:27 +0000
            Re: Request for comments on a first forth program anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-23 13:44 +0000
  Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-20 20:02 -0700
    Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-21 03:36 +0000
      Re: Request for comments on a first forth program hughaguilar96@yahoo.com - 2013-07-20 22:28 -0700
        Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-21 10:31 +0000
    Re: Request for comments on a first forth program rickman <gnuarm@gmail.com> - 2013-07-20 23:41 -0400
  Re: Request for comments on a first forth program anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 15:36 +0000
  Re: Request for comments on a first forth program Lars Brinkhoff <lars.spam@nocrew.org> - 2013-07-23 12:22 +0200
    Re: Request for comments on a first forth program Christian Kellermann <ckeen@pestilenz.org> - 2013-07-23 13:44 +0200
      Re: Request for comments on a first forth program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-23 12:26 +0000
    Re: Request for comments on a first forth program "Elizabeth D. Rather" <erather@forth.com> - 2013-07-23 07:10 -1000
    Re: Request for comments on a first forth program stephenXXX@mpeforth.com (Stephen Pelc) - 2013-07-24 09:30 +0000

csiph-web