Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Sorry. I just realized this sentance makes no sense :) -- Ian Main


devel / comp.lang.forth / Re: Learn forth: how forth nests words properly ?

SubjectAuthor
* Learn forth: how forth nests words properly ?fabianor...@gmail.com
+- Re: Learn forth: how forth nests words properly ?minf...@arcor.de
`* Re: Learn forth: how forth nests words properly ?Anton Ertl
 +- Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
 +* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
 |+- Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
 |+* Re: Learn forth: how forth nests words properly ?Mark Wills
 ||`* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
 || `* Re: Learn forth: how forth nests words properly ?Mark Wills
 ||  `- Re: Learn forth: how forth nests words properly ?dxforth
 |+* Re: Learn forth: how forth nests words properly ?dxforth
 ||`* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
 || `- Re: Learn forth: how forth nests words properly ?dxforth
 |`- Re: Learn forth: how forth nests words properly ?Anton Ertl
 `* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
  +- Re: Learn forth: how forth nests words properly ?S Jack
  +* Re: Learn forth: how forth nests words properly ?Brian Fox
  |`* Re: Learn forth: how forth nests words properly ?minf...@arcor.de
  | `* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
  |  +* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
  |  |`- Re: Learn forth: how forth nests words properly ?Howerd Oakford
  |  +- Re: Learn forth: how forth nests words properly ?Mark Wills
  |  `* Re: Learn forth: how forth nests words properly ?Brian Fox
  |   `* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
  |    +* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
  |    |+* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
  |    ||`* Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
  |    || `- Re: Learn forth: how forth nests words properly ?fabianor...@gmail.com
  |    |+* Re: Learn forth: how forth nests words properly ?Brian Fox
  |    ||`- Re: Learn forth: how forth nests words properly ?Paul Rubin
  |    |`* Re: Learn forth: how forth nests words properly ?Anton Ertl
  |    | `- Re: Learn forth: how forth nests words properly ?dxforth
  |    `- Re: Learn forth: how forth nests words properly ?Howerd Oakford
  `- Re: Learn forth: how forth nests words properly ?Anton Ertl

Pages:12
Re: Learn forth: how forth nests words properly ?

<ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16662&group=comp.lang.forth#16662

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:c68:: with SMTP id t8mr7064073qvj.39.1644127556289;
Sat, 05 Feb 2022 22:05:56 -0800 (PST)
X-Received: by 2002:a05:622a:646:: with SMTP id a6mr4365500qtb.77.1644127554995;
Sat, 05 Feb 2022 22:05:54 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Feb 2022 22:05:54 -0800 (PST)
In-Reply-To: <d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=168.121.177.102; posting-account=OMrK2AoAAACPu8JcOP64zhFwVmCz0fk3
NNTP-Posting-Host: 168.121.177.102
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com>
<2022Feb2.114118@mips.complang.tuwien.ac.at> <b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com>
<c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com> <6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com>
<ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com> <2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com>
<d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
Subject: Re: Learn forth: how forth nests words properly ?
From: fabianor...@gmail.com (fabianor...@gmail.com)
Injection-Date: Sun, 06 Feb 2022 06:05:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 192
 by: fabianor...@gmail.co - Sun, 6 Feb 2022 06:05 UTC

Em sábado, 5 de fevereiro de 2022 às 22:21:38 UTC-3, fabianor...@gmail.com escreveu:
> Em sábado, 5 de fevereiro de 2022 às 21:38:26 UTC-3, Brian Fox escreveu:
> > On Friday, February 4, 2022 at 9:53:50 AM UTC-5, fabianor...@gmail.com wrote:
> > > Em sexta-feira, 4 de fevereiro de 2022 às 05:26:56 UTC-3, minf....@arcor.de escreveu:
> > > > Brian Fox schrieb am Freitag, 4. Februar 2022 um 03:23:27 UTC+1:
> > > > > On Wednesday, February 2, 2022 at 9:38:21 AM UTC-5, fabianor...@gmail.com wrote:
> > > > > > Em quarta-feira, 2 de fevereiro de 2022 às 07:50:05 UTC-3, Anton Ertl escreveu:
> > > > > > > "fabianor...@gmail.com" <fabianor...@gmail.com> writes:
> > > > > > > >I'm studying the forth language and I have a question about word nesting: s=
> > > > > > > >uppose I created a word "program version 1.0" and it would stay inside the =
> > > > > > > >word "info" along with other words, then I modified "program version" for s=
> > > > > > > >ome reason ( version 2.0). The case is that now version of the program is n=
> > > > > > > >ot 2.0 but 1.0 .
> > > > > > > >If I were programming defining words and one better grouped several togethe=
> > > > > > > >r soon it could become hell with a minimum of carelessness! Forgetting to r=
> > > > > > > >edefine some words.
> > > > > > > >I know that the field pointers still point to their old definitions and for=
> > > > > > > > design reasons (I believe) because it is minimalist and a lot of use in li=
> > > > > > > >mited systems it doesn't adopt garbage collection but "overwrites another d=
> > > > > > > >efinition in the dictionary" seems pretty smart for the embedded world, but=
> > > > > > > > if the code grows too large, it looks like this will give a lot of headach=
> > > > > > > >e.
> > > > > > > >So... how is forth's way of dealing with this?
> > > > > > > It's not clear if I understand what you mean, but I interpret the
> > > > > > > question as:
> > > > > > >
> > > > > > > You load new versions of a program on top of old versions, repeatedly,
> > > > > > > and wonder about the memory consumption of this approach, and how
> > > > > > > Forth deals with it.
> > > > > > >
> > > > > > > My anser to that question is that if you load the program N times, you
> > > > > > > will typically consume N times as much memory as when you load it
> > > > > > > once. There are several ways to deal with that in Forth: One is to
> > > > > > > end the current session and start a new one when you want to load a
> > > > > > > new version. Another is to forget the old program (with FORGET,
> > > > > > > MARKER, or (nonstandard, but used by some) ANEW) and then load the new
> > > > > > > one without ending the session.
> > > > > > >
> > > > > > > - 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 2021: https://euro.theforth.net/2021
> > > > > > In other languages u recompile or interpreted overwrite the function(word) and move on(of course depending on the size to recompile... )
> > > > > > Forth uses a dictionary that creates another definition and does not overwrite or erase the previous one. Which ends up creating two words with the same name in the system without me realizing it.
> > > > > > As I'm new to forth I figured I shouldn't be doing things the forth way.
> > > > > Something that has not been mentioned is how the Forth dictionary is searched.
> > > > > The search starts at the last definition, in other words from the back to front.
> > > > >
> > > > > If I create:
> > > > > : WORD1 ." Hello" ;
> > > > > : WORD1 ." World ;
> > > > > : WORD1 ." WHAT?" ;
> > > > >
> > > > > Yes three words with the same name are created
> > > > > BUT! Forth can now only find the last one defined. Why?
> > > > > Because the search begins at the _ LAST_ word added to the dictionary.
> > > > >
> > > > > This creates a situation that computer science calls a "hyper-static" name state.
> > > > >
> > > > > This can lead to code where the same name can be used in different
> > > > > definitions with no problem but it is probably NOT wise for your sanity. :)
> > > > >
> > > > > VARIABLE X
> > > > > : GETX X @ . ; \ shows the last X defined
> > > > >
> > > > > VARIABLE X
> > > > > : GET-THISX X @ . ; \ shows contents of the second X
> > > > >
> > > > > VARIABLE X
> > > > > : OhMYGOODNESS X @ . ; \ shows the contents of the third X
> > > > >
> > > > > So it is not what you are used to perhaps but it works fine once you know how it operates.
> > > > > Hope this removes your confusion.
> > > > To rescue some sanity: ;-)
> > > > When those variables are in different wordlists, changing the search order
> > > > can do wonders
> > > I think Mr dxforth and Brian Fox only saw one of the last posts, because the problem is the exact opposite.
> > > Mark Wills is trying to help me how I can get around this problem.
> > Nope.
> > I read all the posts.
> >
> > It seems to me that you have not understood how Forth is used to develop an application.
> > As long as you continue to see it like another language you can't really move forward with it.
> > It's closer to a macro-assembler for a two stack machine than it is to other HLLs.
> >
> > DEFER words are great but they have specific purposes and that does not mean making
> > everything in your program deferred. If this is the only solution to your problems then your
> > Forth program is wrong IHMO.
> >
> > Forth development proceeds by creating some words you need for your application
> > and you re-compile them until they are error free. You test them at the command line or
> > with embedded test code as you prefer.
> >
> > Put that working code in a file and INCLUDE that file at the top of your application.
> >
> > Repeat that process with the next set of support routines until you have all your
> > intermediate code complete and tested.
> > Now you write the final application file which INCLUDEs all the support files
> > and you write the final application using those words.
> >
> > If you have a lot of internal stuff that needs changing the application was
> > never finished. Fix the problems and re-compile it all.
> > It only takes seconds with a good Forth system.
> >
> > Some Forth applications keep parts of the program as Text that is compiled on
> > demand because it is fast enough to do that.
> hello Howard! I didn't understand how "empty" really works, could you explain it better?
> From what little I understand she somehow warns me of the changes. That the gforth I'm using together with win32forth for study already does.
> I just found that re-defining words leads a beginner to silly stumbles and becomes a worry and a lot of work as the program grows and changes. So I thought I must be doing it in a bad way because I'm still inexperienced.
> So I made this post.
> I saw the link about holonforth, interesting, it seems to me that it does not suffer from this problem and has a navigation system with many subdivisions of the code. Just the script that didn't look like a "common" forth.
> Looks like sqliteforth haha interesting.
Hi Brian fox, u are right, i still don't know how the forth system works.
Yes the words defer are not for that and that's what I was talking about with mark wills.
Some software doesn't need to change but others change constantly, a bug found, a new feature, an update from a legacy system or for any reason and even (happens a lot on the web) a software grows so much that the client and the software company make it become "PARTNERS".
I don't even need to go that far, see how many people depend on third party api and libs and even a driver can be updated so subject to continuous change.
Forth seems to be very good for rapid prototyping! build, test, change quickly and redo from scratch.
The lack of a unique identifier or some way around it in order to create nests at will is unnecessarily limiting.
As I commented above creating a link to the body of the definition and on redefining it discards it and the link points to the new definition and sweeping the dictionary behind other definitions where it was nested as well and updating the body of the definitions (a way I thought to resolve this).


Click here to read the complete article
Re: Learn forth: how forth nests words properly ?

<bc3d5924-01a1-4887-aca2-5c42275fbbe0n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16663&group=comp.lang.forth#16663

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:15cc:: with SMTP id o12mr3645311qkm.152.1644129921220;
Sat, 05 Feb 2022 22:45:21 -0800 (PST)
X-Received: by 2002:a05:6214:2349:: with SMTP id hu9mr6104490qvb.16.1644129921003;
Sat, 05 Feb 2022 22:45:21 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Feb 2022 22:45:20 -0800 (PST)
In-Reply-To: <ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=168.121.177.102; posting-account=OMrK2AoAAACPu8JcOP64zhFwVmCz0fk3
NNTP-Posting-Host: 168.121.177.102
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com>
<2022Feb2.114118@mips.complang.tuwien.ac.at> <b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com>
<c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com> <6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com>
<ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com> <2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com>
<d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com> <ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bc3d5924-01a1-4887-aca2-5c42275fbbe0n@googlegroups.com>
Subject: Re: Learn forth: how forth nests words properly ?
From: fabianor...@gmail.com (fabianor...@gmail.com)
Injection-Date: Sun, 06 Feb 2022 06:45:21 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 225
 by: fabianor...@gmail.co - Sun, 6 Feb 2022 06:45 UTC

Em domingo, 6 de fevereiro de 2022 às 03:05:57 UTC-3, fabianor...@gmail.com escreveu:
> Em sábado, 5 de fevereiro de 2022 às 22:21:38 UTC-3, fabianor....@gmail.com escreveu:
> > Em sábado, 5 de fevereiro de 2022 às 21:38:26 UTC-3, Brian Fox escreveu:
> > > On Friday, February 4, 2022 at 9:53:50 AM UTC-5, fabianor...@gmail.com wrote:
> > > > Em sexta-feira, 4 de fevereiro de 2022 às 05:26:56 UTC-3, minf....@arcor.de escreveu:
> > > > > Brian Fox schrieb am Freitag, 4. Februar 2022 um 03:23:27 UTC+1:
> > > > > > On Wednesday, February 2, 2022 at 9:38:21 AM UTC-5, fabianor...@gmail.com wrote:
> > > > > > > Em quarta-feira, 2 de fevereiro de 2022 às 07:50:05 UTC-3, Anton Ertl escreveu:
> > > > > > > > "fabianor...@gmail.com" <fabianor...@gmail.com> writes:
> > > > > > > > >I'm studying the forth language and I have a question about word nesting: s=
> > > > > > > > >uppose I created a word "program version 1.0" and it would stay inside the =
> > > > > > > > >word "info" along with other words, then I modified "program version" for s=
> > > > > > > > >ome reason ( version 2.0). The case is that now version of the program is n=
> > > > > > > > >ot 2.0 but 1.0 .
> > > > > > > > >If I were programming defining words and one better grouped several togethe=
> > > > > > > > >r soon it could become hell with a minimum of carelessness! Forgetting to r=
> > > > > > > > >edefine some words.
> > > > > > > > >I know that the field pointers still point to their old definitions and for=
> > > > > > > > > design reasons (I believe) because it is minimalist and a lot of use in li=
> > > > > > > > >mited systems it doesn't adopt garbage collection but "overwrites another d=
> > > > > > > > >efinition in the dictionary" seems pretty smart for the embedded world, but=
> > > > > > > > > if the code grows too large, it looks like this will give a lot of headach=
> > > > > > > > >e.
> > > > > > > > >So... how is forth's way of dealing with this?
> > > > > > > > It's not clear if I understand what you mean, but I interpret the
> > > > > > > > question as:
> > > > > > > >
> > > > > > > > You load new versions of a program on top of old versions, repeatedly,
> > > > > > > > and wonder about the memory consumption of this approach, and how
> > > > > > > > Forth deals with it.
> > > > > > > >
> > > > > > > > My anser to that question is that if you load the program N times, you
> > > > > > > > will typically consume N times as much memory as when you load it
> > > > > > > > once. There are several ways to deal with that in Forth: One is to
> > > > > > > > end the current session and start a new one when you want to load a
> > > > > > > > new version. Another is to forget the old program (with FORGET,
> > > > > > > > MARKER, or (nonstandard, but used by some) ANEW) and then load the new
> > > > > > > > one without ending the session.
> > > > > > > >
> > > > > > > > - 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 2021: https://euro.theforth.net/2021
> > > > > > > In other languages u recompile or interpreted overwrite the function(word) and move on(of course depending on the size to recompile... )
> > > > > > > Forth uses a dictionary that creates another definition and does not overwrite or erase the previous one. Which ends up creating two words with the same name in the system without me realizing it.
> > > > > > > As I'm new to forth I figured I shouldn't be doing things the forth way.
> > > > > > Something that has not been mentioned is how the Forth dictionary is searched.
> > > > > > The search starts at the last definition, in other words from the back to front.
> > > > > >
> > > > > > If I create:
> > > > > > : WORD1 ." Hello" ;
> > > > > > : WORD1 ." World ;
> > > > > > : WORD1 ." WHAT?" ;
> > > > > >
> > > > > > Yes three words with the same name are created
> > > > > > BUT! Forth can now only find the last one defined. Why?
> > > > > > Because the search begins at the _ LAST_ word added to the dictionary.
> > > > > >
> > > > > > This creates a situation that computer science calls a "hyper-static" name state.
> > > > > >
> > > > > > This can lead to code where the same name can be used in different
> > > > > > definitions with no problem but it is probably NOT wise for your sanity. :)
> > > > > >
> > > > > > VARIABLE X
> > > > > > : GETX X @ . ; \ shows the last X defined
> > > > > >
> > > > > > VARIABLE X
> > > > > > : GET-THISX X @ . ; \ shows contents of the second X
> > > > > >
> > > > > > VARIABLE X
> > > > > > : OhMYGOODNESS X @ . ; \ shows the contents of the third X
> > > > > >
> > > > > > So it is not what you are used to perhaps but it works fine once you know how it operates.
> > > > > > Hope this removes your confusion.
> > > > > To rescue some sanity: ;-)
> > > > > When those variables are in different wordlists, changing the search order
> > > > > can do wonders
> > > > I think Mr dxforth and Brian Fox only saw one of the last posts, because the problem is the exact opposite.
> > > > Mark Wills is trying to help me how I can get around this problem.
> > > Nope.
> > > I read all the posts.
> > >
> > > It seems to me that you have not understood how Forth is used to develop an application.
> > > As long as you continue to see it like another language you can't really move forward with it.
> > > It's closer to a macro-assembler for a two stack machine than it is to other HLLs.
> > >
> > > DEFER words are great but they have specific purposes and that does not mean making
> > > everything in your program deferred. If this is the only solution to your problems then your
> > > Forth program is wrong IHMO.
> > >
> > > Forth development proceeds by creating some words you need for your application
> > > and you re-compile them until they are error free. You test them at the command line or
> > > with embedded test code as you prefer.
> > >
> > > Put that working code in a file and INCLUDE that file at the top of your application.
> > >
> > > Repeat that process with the next set of support routines until you have all your
> > > intermediate code complete and tested.
> > > Now you write the final application file which INCLUDEs all the support files
> > > and you write the final application using those words.
> > >
> > > If you have a lot of internal stuff that needs changing the application was
> > > never finished. Fix the problems and re-compile it all.
> > > It only takes seconds with a good Forth system.
> > >
> > > Some Forth applications keep parts of the program as Text that is compiled on
> > > demand because it is fast enough to do that.
> > hello Howard! I didn't understand how "empty" really works, could you explain it better?
> > From what little I understand she somehow warns me of the changes. That the gforth I'm using together with win32forth for study already does.
> > I just found that re-defining words leads a beginner to silly stumbles and becomes a worry and a lot of work as the program grows and changes. So I thought I must be doing it in a bad way because I'm still inexperienced.
> > So I made this post.
> > I saw the link about holonforth, interesting, it seems to me that it does not suffer from this problem and has a navigation system with many subdivisions of the code. Just the script that didn't look like a "common" forth..
> > Looks like sqliteforth haha interesting.
> Hi Brian fox, u are right, i still don't know how the forth system works.
> Yes the words defer are not for that and that's what I was talking about with mark wills.
> Some software doesn't need to change but others change constantly, a bug found, a new feature, an update from a legacy system or for any reason and even (happens a lot on the web) a software grows so much that the client and the software company make it become "PARTNERS".
> I don't even need to go that far, see how many people depend on third party api and libs and even a driver can be updated so subject to continuous change.
> Forth seems to be very good for rapid prototyping! build, test, change quickly and redo from scratch.
> The lack of a unique identifier or some way around it in order to create nests at will is unnecessarily limiting.
> As I commented above creating a link to the body of the definition and on redefining it discards it and the link points to the new definition and sweeping the dictionary behind other definitions where it was nested as well and updating the body of the definitions (a way I thought to resolve this).
Look at it from the perspective of a customer who uses a product: I don't want because of this to be hunting around in a legacy system for nested resets that might blow up in my face or have to limit myself at coding time that it wouldn't be a good idea to use this like a nested word because later I can change it and in the future there may already be other nestings that it was part of and another.
It doesn't seem coherent to have to create a data structure for this.
Using nested words seems to me a very natural way in forth.
Imagine having to reset the cf or pf of them all manually in an editor! I'm on an interactive system!
This is clearly a design issue.
I don't know if I was emphatic enough, but a programmer of any other language he sees would recognize this.
Please fix this is getting embarrassing.
Imagine a swift forth client using the system to experiment and now he has a behavior in one place and another in another and the only thing he gets is a warning the word is not unique. WATHECK! REALLY!
It's ok a private forth that the person uses for himself, but a forth for others.
IF I were a swift customer as I was experiencing this I would think this company is not serious and if it was something non-commercial I would think it is quite amateurish.
This should be a source of experimenters who will later become detractors of forth.
Seriously fix this.
Don't go through this constraint.
When it comes time to create my own forward system this is already noted.


Click here to read the complete article
Re: Learn forth: how forth nests words properly ?

<16862527-3373-4814-98c8-debc55f02d7cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16664&group=comp.lang.forth#16664

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:3709:: with SMTP id de9mr3529435qkb.746.1644130376362;
Sat, 05 Feb 2022 22:52:56 -0800 (PST)
X-Received: by 2002:a05:620a:1914:: with SMTP id bj20mr3536653qkb.56.1644130376136;
Sat, 05 Feb 2022 22:52:56 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Feb 2022 22:52:55 -0800 (PST)
In-Reply-To: <bc3d5924-01a1-4887-aca2-5c42275fbbe0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=168.121.177.102; posting-account=OMrK2AoAAACPu8JcOP64zhFwVmCz0fk3
NNTP-Posting-Host: 168.121.177.102
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com>
<2022Feb2.114118@mips.complang.tuwien.ac.at> <b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com>
<c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com> <6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com>
<ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com> <2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com>
<d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com> <ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
<bc3d5924-01a1-4887-aca2-5c42275fbbe0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <16862527-3373-4814-98c8-debc55f02d7cn@googlegroups.com>
Subject: Re: Learn forth: how forth nests words properly ?
From: fabianor...@gmail.com (fabianor...@gmail.com)
Injection-Date: Sun, 06 Feb 2022 06:52:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 238
 by: fabianor...@gmail.co - Sun, 6 Feb 2022 06:52 UTC

Em domingo, 6 de fevereiro de 2022 às 03:45:22 UTC-3, fabianor...@gmail.com escreveu:
> Em domingo, 6 de fevereiro de 2022 às 03:05:57 UTC-3, fabianor...@gmail.com escreveu:
> > Em sábado, 5 de fevereiro de 2022 às 22:21:38 UTC-3, fabianor....@gmail.com escreveu:
> > > Em sábado, 5 de fevereiro de 2022 às 21:38:26 UTC-3, Brian Fox escreveu:
> > > > On Friday, February 4, 2022 at 9:53:50 AM UTC-5, fabianor...@gmail.com wrote:
> > > > > Em sexta-feira, 4 de fevereiro de 2022 às 05:26:56 UTC-3, minf...@arcor.de escreveu:
> > > > > > Brian Fox schrieb am Freitag, 4. Februar 2022 um 03:23:27 UTC+1:
> > > > > > > On Wednesday, February 2, 2022 at 9:38:21 AM UTC-5, fabianor....@gmail.com wrote:
> > > > > > > > Em quarta-feira, 2 de fevereiro de 2022 às 07:50:05 UTC-3, Anton Ertl escreveu:
> > > > > > > > > "fabianor...@gmail.com" <fabianor...@gmail.com> writes:
> > > > > > > > > >I'm studying the forth language and I have a question about word nesting: s=
> > > > > > > > > >uppose I created a word "program version 1.0" and it would stay inside the =
> > > > > > > > > >word "info" along with other words, then I modified "program version" for s=
> > > > > > > > > >ome reason ( version 2.0). The case is that now version of the program is n=
> > > > > > > > > >ot 2.0 but 1.0 .
> > > > > > > > > >If I were programming defining words and one better grouped several togethe=
> > > > > > > > > >r soon it could become hell with a minimum of carelessness! Forgetting to r=
> > > > > > > > > >edefine some words.
> > > > > > > > > >I know that the field pointers still point to their old definitions and for=
> > > > > > > > > > design reasons (I believe) because it is minimalist and a lot of use in li=
> > > > > > > > > >mited systems it doesn't adopt garbage collection but "overwrites another d=
> > > > > > > > > >efinition in the dictionary" seems pretty smart for the embedded world, but=
> > > > > > > > > > if the code grows too large, it looks like this will give a lot of headach=
> > > > > > > > > >e.
> > > > > > > > > >So... how is forth's way of dealing with this?
> > > > > > > > > It's not clear if I understand what you mean, but I interpret the
> > > > > > > > > question as:
> > > > > > > > >
> > > > > > > > > You load new versions of a program on top of old versions, repeatedly,
> > > > > > > > > and wonder about the memory consumption of this approach, and how
> > > > > > > > > Forth deals with it.
> > > > > > > > >
> > > > > > > > > My anser to that question is that if you load the program N times, you
> > > > > > > > > will typically consume N times as much memory as when you load it
> > > > > > > > > once. There are several ways to deal with that in Forth: One is to
> > > > > > > > > end the current session and start a new one when you want to load a
> > > > > > > > > new version. Another is to forget the old program (with FORGET,
> > > > > > > > > MARKER, or (nonstandard, but used by some) ANEW) and then load the new
> > > > > > > > > one without ending the session.
> > > > > > > > >
> > > > > > > > > - 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 2021: https://euro.theforth.net/2021
> > > > > > > > In other languages u recompile or interpreted overwrite the function(word) and move on(of course depending on the size to recompile... )
> > > > > > > > Forth uses a dictionary that creates another definition and does not overwrite or erase the previous one. Which ends up creating two words with the same name in the system without me realizing it.
> > > > > > > > As I'm new to forth I figured I shouldn't be doing things the forth way.
> > > > > > > Something that has not been mentioned is how the Forth dictionary is searched.
> > > > > > > The search starts at the last definition, in other words from the back to front.
> > > > > > >
> > > > > > > If I create:
> > > > > > > : WORD1 ." Hello" ;
> > > > > > > : WORD1 ." World ;
> > > > > > > : WORD1 ." WHAT?" ;
> > > > > > >
> > > > > > > Yes three words with the same name are created
> > > > > > > BUT! Forth can now only find the last one defined. Why?
> > > > > > > Because the search begins at the _ LAST_ word added to the dictionary.
> > > > > > >
> > > > > > > This creates a situation that computer science calls a "hyper-static" name state.
> > > > > > >
> > > > > > > This can lead to code where the same name can be used in different
> > > > > > > definitions with no problem but it is probably NOT wise for your sanity. :)
> > > > > > >
> > > > > > > VARIABLE X
> > > > > > > : GETX X @ . ; \ shows the last X defined
> > > > > > >
> > > > > > > VARIABLE X
> > > > > > > : GET-THISX X @ . ; \ shows contents of the second X
> > > > > > >
> > > > > > > VARIABLE X
> > > > > > > : OhMYGOODNESS X @ . ; \ shows the contents of the third X
> > > > > > >
> > > > > > > So it is not what you are used to perhaps but it works fine once you know how it operates.
> > > > > > > Hope this removes your confusion.
> > > > > > To rescue some sanity: ;-)
> > > > > > When those variables are in different wordlists, changing the search order
> > > > > > can do wonders
> > > > > I think Mr dxforth and Brian Fox only saw one of the last posts, because the problem is the exact opposite.
> > > > > Mark Wills is trying to help me how I can get around this problem..
> > > > Nope.
> > > > I read all the posts.
> > > >
> > > > It seems to me that you have not understood how Forth is used to develop an application.
> > > > As long as you continue to see it like another language you can't really move forward with it.
> > > > It's closer to a macro-assembler for a two stack machine than it is to other HLLs.
> > > >
> > > > DEFER words are great but they have specific purposes and that does not mean making
> > > > everything in your program deferred. If this is the only solution to your problems then your
> > > > Forth program is wrong IHMO.
> > > >
> > > > Forth development proceeds by creating some words you need for your application
> > > > and you re-compile them until they are error free. You test them at the command line or
> > > > with embedded test code as you prefer.
> > > >
> > > > Put that working code in a file and INCLUDE that file at the top of your application.
> > > >
> > > > Repeat that process with the next set of support routines until you have all your
> > > > intermediate code complete and tested.
> > > > Now you write the final application file which INCLUDEs all the support files
> > > > and you write the final application using those words.
> > > >
> > > > If you have a lot of internal stuff that needs changing the application was
> > > > never finished. Fix the problems and re-compile it all.
> > > > It only takes seconds with a good Forth system.
> > > >
> > > > Some Forth applications keep parts of the program as Text that is compiled on
> > > > demand because it is fast enough to do that.
> > > hello Howard! I didn't understand how "empty" really works, could you explain it better?
> > > From what little I understand she somehow warns me of the changes. That the gforth I'm using together with win32forth for study already does.
> > > I just found that re-defining words leads a beginner to silly stumbles and becomes a worry and a lot of work as the program grows and changes. So I thought I must be doing it in a bad way because I'm still inexperienced..
> > > So I made this post.
> > > I saw the link about holonforth, interesting, it seems to me that it does not suffer from this problem and has a navigation system with many subdivisions of the code. Just the script that didn't look like a "common" forth.
> > > Looks like sqliteforth haha interesting.
> > Hi Brian fox, u are right, i still don't know how the forth system works.
> > Yes the words defer are not for that and that's what I was talking about with mark wills.
> > Some software doesn't need to change but others change constantly, a bug found, a new feature, an update from a legacy system or for any reason and even (happens a lot on the web) a software grows so much that the client and the software company make it become "PARTNERS".
> > I don't even need to go that far, see how many people depend on third party api and libs and even a driver can be updated so subject to continuous change.
> > Forth seems to be very good for rapid prototyping! build, test, change quickly and redo from scratch.
> > The lack of a unique identifier or some way around it in order to create nests at will is unnecessarily limiting.
> > As I commented above creating a link to the body of the definition and on redefining it discards it and the link points to the new definition and sweeping the dictionary behind other definitions where it was nested as well and updating the body of the definitions (a way I thought to resolve this).
> Look at it from the perspective of a customer who uses a product: I don't want because of this to be hunting around in a legacy system for nested resets that might blow up in my face or have to limit myself at coding time that it wouldn't be a good idea to use this like a nested word because later I can change it and in the future there may already be other nestings that it was part of and another.
> It doesn't seem coherent to have to create a data structure for this.
> Using nested words seems to me a very natural way in forth.
> Imagine having to reset the cf or pf of them all manually in an editor! I'm on an interactive system!
> This is clearly a design issue.
> I don't know if I was emphatic enough, but a programmer of any other language he sees would recognize this.
> Please fix this is getting embarrassing.
> Imagine a swift forth client using the system to experiment and now he has a behavior in one place and another in another and the only thing he gets is a warning the word is not unique. WATHECK! REALLY!
> It's ok a private forth that the person uses for himself, but a forth for others.
> IF I were a swift customer as I was experiencing this I would think this company is not serious and if it was something non-commercial I would think it is quite amateurish.
> This should be a source of experimenters who will later become detractors of forth.
> Seriously fix this.
> Don't go through this constraint.
> When it comes time to create my own forward system this is already noted.
I don't want to be rude to anyone, ask for a second opinion if you need someone from outside.
a php programmer who was once a laughing stock in the early days of php would say something similar and this is a pretty clear entry barrier for beginners.
I hope you continue to help me, it was very good.
I still have a lot of questions and ideas for resources for forth (which probably shouldn't be anything new xD).
thanks


Click here to read the complete article
Re: Learn forth: how forth nests words properly ?

<067e3daa-52d2-4f79-81dd-28129040283bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16665&group=comp.lang.forth#16665

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:28c3:: with SMTP id l3mr3426784qkp.633.1644131109269;
Sat, 05 Feb 2022 23:05:09 -0800 (PST)
X-Received: by 2002:a05:620a:853:: with SMTP id u19mr3585573qku.188.1644131109077;
Sat, 05 Feb 2022 23:05:09 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Feb 2022 23:05:08 -0800 (PST)
In-Reply-To: <16862527-3373-4814-98c8-debc55f02d7cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=168.121.177.102; posting-account=OMrK2AoAAACPu8JcOP64zhFwVmCz0fk3
NNTP-Posting-Host: 168.121.177.102
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com>
<2022Feb2.114118@mips.complang.tuwien.ac.at> <b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com>
<c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com> <6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com>
<ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com> <2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com>
<d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com> <ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
<bc3d5924-01a1-4887-aca2-5c42275fbbe0n@googlegroups.com> <16862527-3373-4814-98c8-debc55f02d7cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <067e3daa-52d2-4f79-81dd-28129040283bn@googlegroups.com>
Subject: Re: Learn forth: how forth nests words properly ?
From: fabianor...@gmail.com (fabianor...@gmail.com)
Injection-Date: Sun, 06 Feb 2022 07:05:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 246
 by: fabianor...@gmail.co - Sun, 6 Feb 2022 07:05 UTC

Em domingo, 6 de fevereiro de 2022 às 03:52:57 UTC-3, fabianor...@gmail.com escreveu:
> Em domingo, 6 de fevereiro de 2022 às 03:45:22 UTC-3, fabianor...@gmail.com escreveu:
> > Em domingo, 6 de fevereiro de 2022 às 03:05:57 UTC-3, fabianor...@gmail.com escreveu:
> > > Em sábado, 5 de fevereiro de 2022 às 22:21:38 UTC-3, fabianor...@gmail.com escreveu:
> > > > Em sábado, 5 de fevereiro de 2022 às 21:38:26 UTC-3, Brian Fox escreveu:
> > > > > On Friday, February 4, 2022 at 9:53:50 AM UTC-5, fabianor...@gmail.com wrote:
> > > > > > Em sexta-feira, 4 de fevereiro de 2022 às 05:26:56 UTC-3, minf...@arcor.de escreveu:
> > > > > > > Brian Fox schrieb am Freitag, 4. Februar 2022 um 03:23:27 UTC+1:
> > > > > > > > On Wednesday, February 2, 2022 at 9:38:21 AM UTC-5, fabianor...@gmail.com wrote:
> > > > > > > > > Em quarta-feira, 2 de fevereiro de 2022 às 07:50:05 UTC-3, Anton Ertl escreveu:
> > > > > > > > > > "fabianor...@gmail.com" <fabianor...@gmail.com> writes:
> > > > > > > > > > >I'm studying the forth language and I have a question about word nesting: s=
> > > > > > > > > > >uppose I created a word "program version 1.0" and it would stay inside the =
> > > > > > > > > > >word "info" along with other words, then I modified "program version" for s=
> > > > > > > > > > >ome reason ( version 2.0). The case is that now version of the program is n=
> > > > > > > > > > >ot 2.0 but 1.0 .
> > > > > > > > > > >If I were programming defining words and one better grouped several togethe=
> > > > > > > > > > >r soon it could become hell with a minimum of carelessness! Forgetting to r=
> > > > > > > > > > >edefine some words.
> > > > > > > > > > >I know that the field pointers still point to their old definitions and for=
> > > > > > > > > > > design reasons (I believe) because it is minimalist and a lot of use in li=
> > > > > > > > > > >mited systems it doesn't adopt garbage collection but "overwrites another d=
> > > > > > > > > > >efinition in the dictionary" seems pretty smart for the embedded world, but=
> > > > > > > > > > > if the code grows too large, it looks like this will give a lot of headach=
> > > > > > > > > > >e.
> > > > > > > > > > >So... how is forth's way of dealing with this?
> > > > > > > > > > It's not clear if I understand what you mean, but I interpret the
> > > > > > > > > > question as:
> > > > > > > > > >
> > > > > > > > > > You load new versions of a program on top of old versions, repeatedly,
> > > > > > > > > > and wonder about the memory consumption of this approach, and how
> > > > > > > > > > Forth deals with it.
> > > > > > > > > >
> > > > > > > > > > My anser to that question is that if you load the program N times, you
> > > > > > > > > > will typically consume N times as much memory as when you load it
> > > > > > > > > > once. There are several ways to deal with that in Forth: One is to
> > > > > > > > > > end the current session and start a new one when you want to load a
> > > > > > > > > > new version. Another is to forget the old program (with FORGET,
> > > > > > > > > > MARKER, or (nonstandard, but used by some) ANEW) and then load the new
> > > > > > > > > > one without ending the session.
> > > > > > > > > >
> > > > > > > > > > - 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 2021: https://euro.theforth.net/2021
> > > > > > > > > In other languages u recompile or interpreted overwrite the function(word) and move on(of course depending on the size to recompile.... )
> > > > > > > > > Forth uses a dictionary that creates another definition and does not overwrite or erase the previous one. Which ends up creating two words with the same name in the system without me realizing it.
> > > > > > > > > As I'm new to forth I figured I shouldn't be doing things the forth way.
> > > > > > > > Something that has not been mentioned is how the Forth dictionary is searched.
> > > > > > > > The search starts at the last definition, in other words from the back to front.
> > > > > > > >
> > > > > > > > If I create:
> > > > > > > > : WORD1 ." Hello" ;
> > > > > > > > : WORD1 ." World ;
> > > > > > > > : WORD1 ." WHAT?" ;
> > > > > > > >
> > > > > > > > Yes three words with the same name are created
> > > > > > > > BUT! Forth can now only find the last one defined. Why?
> > > > > > > > Because the search begins at the _ LAST_ word added to the dictionary.
> > > > > > > >
> > > > > > > > This creates a situation that computer science calls a "hyper-static" name state.
> > > > > > > >
> > > > > > > > This can lead to code where the same name can be used in different
> > > > > > > > definitions with no problem but it is probably NOT wise for your sanity. :)
> > > > > > > >
> > > > > > > > VARIABLE X
> > > > > > > > : GETX X @ . ; \ shows the last X defined
> > > > > > > >
> > > > > > > > VARIABLE X
> > > > > > > > : GET-THISX X @ . ; \ shows contents of the second X
> > > > > > > >
> > > > > > > > VARIABLE X
> > > > > > > > : OhMYGOODNESS X @ . ; \ shows the contents of the third X
> > > > > > > >
> > > > > > > > So it is not what you are used to perhaps but it works fine once you know how it operates.
> > > > > > > > Hope this removes your confusion.
> > > > > > > To rescue some sanity: ;-)
> > > > > > > When those variables are in different wordlists, changing the search order
> > > > > > > can do wonders
> > > > > > I think Mr dxforth and Brian Fox only saw one of the last posts, because the problem is the exact opposite.
> > > > > > Mark Wills is trying to help me how I can get around this problem.
> > > > > Nope.
> > > > > I read all the posts.
> > > > >
> > > > > It seems to me that you have not understood how Forth is used to develop an application.
> > > > > As long as you continue to see it like another language you can't really move forward with it.
> > > > > It's closer to a macro-assembler for a two stack machine than it is to other HLLs.
> > > > >
> > > > > DEFER words are great but they have specific purposes and that does not mean making
> > > > > everything in your program deferred. If this is the only solution to your problems then your
> > > > > Forth program is wrong IHMO.
> > > > >
> > > > > Forth development proceeds by creating some words you need for your application
> > > > > and you re-compile them until they are error free. You test them at the command line or
> > > > > with embedded test code as you prefer.
> > > > >
> > > > > Put that working code in a file and INCLUDE that file at the top of your application.
> > > > >
> > > > > Repeat that process with the next set of support routines until you have all your
> > > > > intermediate code complete and tested.
> > > > > Now you write the final application file which INCLUDEs all the support files
> > > > > and you write the final application using those words.
> > > > >
> > > > > If you have a lot of internal stuff that needs changing the application was
> > > > > never finished. Fix the problems and re-compile it all.
> > > > > It only takes seconds with a good Forth system.
> > > > >
> > > > > Some Forth applications keep parts of the program as Text that is compiled on
> > > > > demand because it is fast enough to do that.
> > > > hello Howard! I didn't understand how "empty" really works, could you explain it better?
> > > > From what little I understand she somehow warns me of the changes. That the gforth I'm using together with win32forth for study already does.
> > > > I just found that re-defining words leads a beginner to silly stumbles and becomes a worry and a lot of work as the program grows and changes. So I thought I must be doing it in a bad way because I'm still inexperienced.
> > > > So I made this post.
> > > > I saw the link about holonforth, interesting, it seems to me that it does not suffer from this problem and has a navigation system with many subdivisions of the code. Just the script that didn't look like a "common" forth.
> > > > Looks like sqliteforth haha interesting.
> > > Hi Brian fox, u are right, i still don't know how the forth system works.
> > > Yes the words defer are not for that and that's what I was talking about with mark wills.
> > > Some software doesn't need to change but others change constantly, a bug found, a new feature, an update from a legacy system or for any reason and even (happens a lot on the web) a software grows so much that the client and the software company make it become "PARTNERS".
> > > I don't even need to go that far, see how many people depend on third party api and libs and even a driver can be updated so subject to continuous change.
> > > Forth seems to be very good for rapid prototyping! build, test, change quickly and redo from scratch.
> > > The lack of a unique identifier or some way around it in order to create nests at will is unnecessarily limiting.
> > > As I commented above creating a link to the body of the definition and on redefining it discards it and the link points to the new definition and sweeping the dictionary behind other definitions where it was nested as well and updating the body of the definitions (a way I thought to resolve this).
> > Look at it from the perspective of a customer who uses a product: I don't want because of this to be hunting around in a legacy system for nested resets that might blow up in my face or have to limit myself at coding time that it wouldn't be a good idea to use this like a nested word because later I can change it and in the future there may already be other nestings that it was part of and another.
> > It doesn't seem coherent to have to create a data structure for this.
> > Using nested words seems to me a very natural way in forth.
> > Imagine having to reset the cf or pf of them all manually in an editor! I'm on an interactive system!
> > This is clearly a design issue.
> > I don't know if I was emphatic enough, but a programmer of any other language he sees would recognize this.
> > Please fix this is getting embarrassing.
> > Imagine a swift forth client using the system to experiment and now he has a behavior in one place and another in another and the only thing he gets is a warning the word is not unique. WATHECK! REALLY!
> > It's ok a private forth that the person uses for himself, but a forth for others.
> > IF I were a swift customer as I was experiencing this I would think this company is not serious and if it was something non-commercial I would think it is quite amateurish.
> > This should be a source of experimenters who will later become detractors of forth.
> > Seriously fix this.
> > Don't go through this constraint.
> > When it comes time to create my own forward system this is already noted.
> I don't want to be rude to anyone, ask for a second opinion if you need someone from outside.
> a php programmer who was once a laughing stock in the early days of php would say something similar and this is a pretty clear entry barrier for beginners.
> I hope you continue to help me, it was very good.
> I still have a lot of questions and ideas for resources for forth (which probably shouldn't be anything new xD).
> thanks
usem isso como um feedback de um recém usuário forth.


Click here to read the complete article
Re: Learn forth: how forth nests words properly ?

<stoakj$6d1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16672&group=comp.lang.forth#16672

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: how...@inventio.co.uk (Howerd Oakford)
Newsgroups: comp.lang.forth
Subject: Re: Learn forth: how forth nests words properly ?
Date: Sun, 6 Feb 2022 12:15:30 +0100
Organization: A noiseless patient Spider
Lines: 230
Message-ID: <stoakj$6d1$1@dont-email.me>
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com>
<2022Feb2.114118@mips.complang.tuwien.ac.at>
<b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com>
<c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com>
<6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com>
<ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com>
<2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com>
<d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 6 Feb 2022 11:15:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1e56ec2d2925cf1f5fd6b51ddc2a3e3b";
logging-data="6561"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4dsZ5MM3+qhTPamBC33uS"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Cancel-Lock: sha1:1kJ+vdq6LlGhrrDnwerqT1mgi9I=
In-Reply-To: <d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com>
 by: Howerd Oakford - Sun, 6 Feb 2022 11:15 UTC

Am 06/02/2022 um 02:21 schrieb fabianor...@gmail.com:
> Em sábado, 5 de fevereiro de 2022 às 21:38:26 UTC-3, Brian Fox escreveu:
>> On Friday, February 4, 2022 at 9:53:50 AM UTC-5, fabianor...@gmail.com wrote:
>>> Em sexta-feira, 4 de fevereiro de 2022 às 05:26:56 UTC-3, minf...@arcor.de escreveu:
>>>> Brian Fox schrieb am Freitag, 4. Februar 2022 um 03:23:27 UTC+1:
>>>>> On Wednesday, February 2, 2022 at 9:38:21 AM UTC-5, fabianor...@gmail.com wrote:
>>>>>> Em quarta-feira, 2 de fevereiro de 2022 às 07:50:05 UTC-3, Anton Ertl escreveu:
>>>>>>> "fabianor...@gmail.com" <fabianor...@gmail.com> writes:
>>>>>>>> I'm studying the forth language and I have a question about word nesting: s=
>>>>>>>> uppose I created a word "program version 1.0" and it would stay inside the =
>>>>>>>> word "info" along with other words, then I modified "program version" for s=
>>>>>>>> ome reason ( version 2.0). The case is that now version of the program is n=
>>>>>>>> ot 2.0 but 1.0 .
>>>>>>>> If I were programming defining words and one better grouped several togethe=
>>>>>>>> r soon it could become hell with a minimum of carelessness! Forgetting to r=
>>>>>>>> edefine some words.
>>>>>>>> I know that the field pointers still point to their old definitions and for=
>>>>>>>> design reasons (I believe) because it is minimalist and a lot of use in li=
>>>>>>>> mited systems it doesn't adopt garbage collection but "overwrites another d=
>>>>>>>> efinition in the dictionary" seems pretty smart for the embedded world, but=
>>>>>>>> if the code grows too large, it looks like this will give a lot of headach=
>>>>>>>> e.
>>>>>>>> So... how is forth's way of dealing with this?
>>>>>>> It's not clear if I understand what you mean, but I interpret the
>>>>>>> question as:
>>>>>>>
>>>>>>> You load new versions of a program on top of old versions, repeatedly,
>>>>>>> and wonder about the memory consumption of this approach, and how
>>>>>>> Forth deals with it.
>>>>>>>
>>>>>>> My anser to that question is that if you load the program N times, you
>>>>>>> will typically consume N times as much memory as when you load it
>>>>>>> once. There are several ways to deal with that in Forth: One is to
>>>>>>> end the current session and start a new one when you want to load a
>>>>>>> new version. Another is to forget the old program (with FORGET,
>>>>>>> MARKER, or (nonstandard, but used by some) ANEW) and then load the new
>>>>>>> one without ending the session.
>>>>>>>
>>>>>>> - 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 2021: https://euro.theforth.net/2021
>>>>>> In other languages u recompile or interpreted overwrite the function(word) and move on(of course depending on the size to recompile... )
>>>>>> Forth uses a dictionary that creates another definition and does not overwrite or erase the previous one. Which ends up creating two words with the same name in the system without me realizing it.
>>>>>> As I'm new to forth I figured I shouldn't be doing things the forth way.
>>>>> Something that has not been mentioned is how the Forth dictionary is searched.
>>>>> The search starts at the last definition, in other words from the back to front.
>>>>>
>>>>> If I create:
>>>>> : WORD1 ." Hello" ;
>>>>> : WORD1 ." World ;
>>>>> : WORD1 ." WHAT?" ;
>>>>>
>>>>> Yes three words with the same name are created
>>>>> BUT! Forth can now only find the last one defined. Why?
>>>>> Because the search begins at the _ LAST_ word added to the dictionary.
>>>>>
>>>>> This creates a situation that computer science calls a "hyper-static" name state.
>>>>>
>>>>> This can lead to code where the same name can be used in different
>>>>> definitions with no problem but it is probably NOT wise for your sanity. :)
>>>>>
>>>>> VARIABLE X
>>>>> : GETX X @ . ; \ shows the last X defined
>>>>>
>>>>> VARIABLE X
>>>>> : GET-THISX X @ . ; \ shows contents of the second X
>>>>>
>>>>> VARIABLE X
>>>>> : OhMYGOODNESS X @ . ; \ shows the contents of the third X
>>>>>
>>>>> So it is not what you are used to perhaps but it works fine once you know how it operates.
>>>>> Hope this removes your confusion.
>>>> To rescue some sanity: ;-)
>>>> When those variables are in different wordlists, changing the search order
>>>> can do wonders
>>> I think Mr dxforth and Brian Fox only saw one of the last posts, because the problem is the exact opposite.
>>> Mark Wills is trying to help me how I can get around this problem.
>> Nope.
>> I read all the posts.
>>
>> It seems to me that you have not understood how Forth is used to develop an application.
>> As long as you continue to see it like another language you can't really move forward with it.
>> It's closer to a macro-assembler for a two stack machine than it is to other HLLs.
>>
>> DEFER words are great but they have specific purposes and that does not mean making
>> everything in your program deferred. If this is the only solution to your problems then your
>> Forth program is wrong IHMO.
>>
>> Forth development proceeds by creating some words you need for your application
>> and you re-compile them until they are error free. You test them at the command line or
>> with embedded test code as you prefer.
>>
>> Put that working code in a file and INCLUDE that file at the top of your application.
>>
>> Repeat that process with the next set of support routines until you have all your
>> intermediate code complete and tested.
>> Now you write the final application file which INCLUDEs all the support files
>> and you write the final application using those words.
>>
>> If you have a lot of internal stuff that needs changing the application was
>> never finished. Fix the problems and re-compile it all.
>> It only takes seconds with a good Forth system.
>>
>> Some Forth applications keep parts of the program as Text that is compiled on
>> demand because it is fast enough to do that.

Am 04/02/2022 um 19:06 schrieb Howerd Oakford:
> Hi fabianor,
>
> The way I avoid this type of problem is by using "empty" at the start
> of a load file or load block.
> This means that everything gets compiled following the order in the
> source. If a word is redefined most systems give you a warning, which
> you can ignore if you like.
> Compilation times for a sizeable test program using swiftForth on
> Windows is about 400 ms, including building an executable.
>
> For a different aproach, Holon allows you to redefine Forth words
> on-the-fly. It stores the source in a database, and compiles with some
> extra space so that it can automatically recompile without shifting
> everthing else around. Link : https://holonforth.com/
>
> Cheers,
> Howerd

> hello Howard! I didn't understand how "empty" really works, could you explain it better?
> From what little I understand she somehow warns me of the changes. That the gforth I'm using together with win32forth for study already does.
> I just found that re-defining words leads a beginner to silly stumbles and becomes a worry and a lot of work as the program grows and changes. So I thought I must be doing it in a bad way because I'm still inexperienced.
> So I made this post.
> I saw the link about holonforth, interesting, it seems to me that it does not suffer from this problem and has a navigation system with many subdivisions of the code. Just the script that didn't look like a "common" forth.
> Looks like sqliteforth haha interesting.


Click here to read the complete article
Re: Learn forth: how forth nests words properly ?

<b01b0a55-ae5f-4e12-8a76-245180f1899an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16676&group=comp.lang.forth#16676

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:190b:: with SMTP id w11mr5274820qtc.186.1644160213008;
Sun, 06 Feb 2022 07:10:13 -0800 (PST)
X-Received: by 2002:ac8:5950:: with SMTP id 16mr5336031qtz.104.1644160212765;
Sun, 06 Feb 2022 07:10:12 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 6 Feb 2022 07:10:12 -0800 (PST)
In-Reply-To: <ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=99.242.210.36; posting-account=2z7GawoAAADc70p5SM5AbaCyzjLblS3g
NNTP-Posting-Host: 99.242.210.36
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com>
<2022Feb2.114118@mips.complang.tuwien.ac.at> <b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com>
<c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com> <6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com>
<ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com> <2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com>
<d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com> <ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b01b0a55-ae5f-4e12-8a76-245180f1899an@googlegroups.com>
Subject: Re: Learn forth: how forth nests words properly ?
From: brian....@brianfox.ca (Brian Fox)
Injection-Date: Sun, 06 Feb 2022 15:10:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 31
 by: Brian Fox - Sun, 6 Feb 2022 15:10 UTC

On Sunday, February 6, 2022 at 1:05:57 AM UTC-5, fabianor...@gmail.com wrote:
> Forth seems to be very good for rapid prototyping! build, test, change quickly and redo from scratch.

Yes that is how it is most commonly used.

> The lack of a unique identifier or some way around it in order to create nests at will is unnecessarily limiting.

I must admit that I am also confused. Perhaps the word "nests" is not translated well to English?
When you say "create nests" I think: Forth is "nested" all the way down. :-)
Words call words, that call words, that call words...
Can you give us another word for "nests" or tell us your native language word?

> As I commented above creating a link to the body of the definition and on redefining it discards it and the link points to the new definition and sweeping the dictionary behind other definitions where it was nested as well and updating the body of the definitions (a way I thought to resolve this).

The short answer: Forth does not do this "out of the box". Re-compile the application.
-OR- if you know exactly the parts that you want to change later, you could used DEFER words for those functions.

It might would help everyone here if you gave us an example the kind of thing you want to accomplish.
Maybe an example in another language?

Re: Learn forth: how forth nests words properly ?

<2022Feb6.162937@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16677&group=comp.lang.forth#16677

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Learn forth: how forth nests words properly ?
Date: Sun, 06 Feb 2022 15:29:37 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 24
Message-ID: <2022Feb6.162937@mips.complang.tuwien.ac.at>
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com> <b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com> <c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com> <6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com> <ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com> <2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com> <d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com> <ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="59a0e21dec4f5ca89a49e7f5be44005c";
logging-data="15124"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dw+ZK+T8jzoQaffebG/3N"
Cancel-Lock: sha1:lO4Styal4Gq9c04e+6q+SRM4ls8=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 6 Feb 2022 15:29 UTC

"fabianor...@gmail.com" <fabianorezende26@gmail.com> writes:
>As I commented above creating a link to the body of the definition and on r=
>edefining it discards it and the link points to the new definition and swee=
>ping the dictionary behind other definitions where it was nested as well an=
>d updating the body of the definitions (a way I thought to resolve this).

It would certainly be possible (and not particularly difficult or
inefficient, especially for separate-header indirect-threaded code
systems) to turn every word into a deferred word; on redefinition,
just define an anonymous word and redirect the old header to the new
anonymous word.

The fact that this has not been done in mainstream Forth indicates
that Forthers don't find this particularly useful, or the mainstream
Forth behaviour particularly burdensome.

However, IIRC HolonForth works the way you prefer.

- 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 2021: https://euro.theforth.net/2021

Re: Learn forth: how forth nests words properly ?

<875yprxzyr.fsf@nightsong.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16694&group=comp.lang.forth#16694

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Learn forth: how forth nests words properly ?
Date: Sun, 06 Feb 2022 16:49:48 -0800
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <875yprxzyr.fsf@nightsong.com>
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com>
<2022Feb2.114118@mips.complang.tuwien.ac.at>
<b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com>
<c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com>
<6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com>
<ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com>
<2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com>
<d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com>
<ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
<b01b0a55-ae5f-4e12-8a76-245180f1899an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="92e79a9cfd2944ef6eaa68b9eeda6dc8";
logging-data="22260"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18FUgry815fv/asdC1HZNyn"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:XXqYHLekZWwlGyjYbXscBLB+zZ4=
sha1:vxA2An1WPV1+2k5FCSqSWEN8UOo=
 by: Paul Rubin - Mon, 7 Feb 2022 00:49 UTC

Brian Fox <brian.fox@brianfox.ca> writes:
> I must admit that I am also confused. Perhaps the word "nests" is not
> translated well to English?

I thought of nested scopes for functions and variables.

Re: Learn forth: how forth nests words properly ?

<stpr9g$1c3f$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16696&group=comp.lang.forth#16696

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Learn forth: how forth nests words properly ?
Date: Mon, 7 Feb 2022 12:05:54 +1100
Organization: Aioe.org NNTP Server
Message-ID: <stpr9g$1c3f$1@gioia.aioe.org>
References: <7d908d30-8439-4926-a0c3-47e802cbb1b0n@googlegroups.com>
<b9ef124f-5ccf-47cd-9d0b-69a3fe46d387n@googlegroups.com>
<c82076ea-f43b-4644-8ee3-e7d80b523857n@googlegroups.com>
<6a23e34e-4dc0-449c-82ee-4a6c99bd9924n@googlegroups.com>
<ff4fbf71-ab4e-4d6f-bcb5-afa3482a95fdn@googlegroups.com>
<2bf304dc-623e-4418-b551-d5f7764dc072n@googlegroups.com>
<d10c1e52-4923-4409-bd0c-4e1e5e7a39e3n@googlegroups.com>
<ca6e9ec5-840d-426e-96c7-76963778af58n@googlegroups.com>
<2022Feb6.162937@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="45167"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Mon, 7 Feb 2022 01:05 UTC

On 7/02/2022 02:29, Anton Ertl wrote:
> "fabianor...@gmail.com" <fabianorezende26@gmail.com> writes:
>>As I commented above creating a link to the body of the definition and on r=
>>edefining it discards it and the link points to the new definition and swee=
>>ping the dictionary behind other definitions where it was nested as well an=
>>d updating the body of the definitions (a way I thought to resolve this).
>
> It would certainly be possible (and not particularly difficult or
> inefficient, especially for separate-header indirect-threaded code
> systems) to turn every word into a deferred word; on redefinition,
> just define an anonymous word and redirect the old header to the new
> anonymous word.
>
> The fact that this has not been done in mainstream Forth indicates
> that Forthers don't find this particularly useful, or the mainstream
> Forth behaviour particularly burdensome.
>
> However, IIRC HolonForth works the way you prefer.

I would have thought Forth less amenable to patch fixes than other langs
given one may need to alter both inputs and outputs of a function.

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor