Talk:Forth (programming language)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
WikiProject Computing / CompSci (Rated GA-class, Mid-importance)
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 GA  This article has been rated as GA-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Computer science (marked as Mid-importance).
Good articleForth (programming language) has been listed as one of the Engineering and technology good articles under the good article criteria. If you can improve it further, please do so. If it no longer meets these criteria, you can reassess it.
Article milestones
June 4, 2006Peer reviewReviewed
June 21, 2006Featured article candidateNot promoted
June 23, 2006Good article nomineeListed
June 25, 2006Featured article candidateNot promoted
November 24, 2006Featured article candidateNot promoted
March 11, 2009Good article reassessmentKept
Current status: Good article

TO DOs[edit]

Mostly as a reminder to myself, here is a list of topics that could be covered by the article. However, most of this is probably too specific for an encyclopedia. I think the article already says most of what would be of interest to a casual reader.

  • typical length of Forth words, general layout of Forth code, stack comments, shadow screens, more on blocks?
  • vocabularies, wordlists (MARKER, FORGET)
  • cells and standard data types (doubles etc.)
  • memory allocation and cell alignment (HERE, comma, ALLOT, ALIGN, ALIGNED, PAD, ALLOCATE, FREE)
  • use of the return stack to reduce "stack gymnastics", interaction of looping constructs with the return stack, locals
  • explain naming conventions, explain bracketing convention for pairs of immediate and non-immediate words ('/['], CHAR/[CHAR], IF/[IF])
  • case (in-)sensitivity during parsing; some (older) Forths store word names as the leading (five?) characters plus the name length.
The first Forths stored three. Ideogram 15:59, 20 June 2006 (UTC)
  • definition words like CREATE/DOES>
This is a pretty important feature of Forth but difficult to explain. Ideogram 15:59, 20 June 2006 (UTC)
  • object-oriented extensions of Forth (mention object-method vs. method-object debate) (talk) 18:45, 24 January 2015 (UTC) Object-method ordering is just one facet of the many differing (and at least as important) details having to do with implementing a Forth object-oriented extension.
  • [IF], [THEN], [ELSE])
  • code examples

Tobias Bergemann 15:38, 20 June 2006 (UTC)

I think this article is already up to FA standards since the primary objection about not enough citations has been addressed. But by all means feel free to improve it further. If you can explain these concepts to a nontechnical reader it can only help. Ideogram 15:59, 20 June 2006 (UTC)

Untrue Statements[edit]

The statement that "C compilers may now generate code with more compactness and performance" is NOT true. Modern Forth systems are executing at 1000x the speed of equivelant C code when they are writen from scratch from the same requirements. This statement should be given a reference or removed. —Preceding unsigned comment added by (talk) 15:29, 13 September 2010 (UTC)

....? What? You can't just say that an not give an example of a system that went written in Forth is "1000x" faster. —Preceding unsigned comment added by (talk) 17:24, 15 January 2011 (UTC)


I don't know about the FA but it is GA status as of now. Lincher 04:01, 23 June 2006 (UTC)

Good job everyone. Now on to Featured Article! Ideogram 04:22, 23 June 2006 (UTC)

Online interpreters[edit]

This section mentions two 'Forths' that break at the slightest typing error (unrecoverable), and in no way represent modern Forth. I say they are curiosities that should be deleted? Mhx 19:32, 12 July 2006 (UTC)

Sounds good to me. --Ideogram 01:20, 13 July 2006 (UTC)

Influences: sources[edit]

Influenced by B5500 - Chuck's HOPL II draft (The Early Years) Influenced Open Firmware - claimed on page (obvious) Influenced Factor programming language - claimed prominently on the author's web page.

On second look, it appears PostScript was also influenced by the B5500, via InterPress and John Gaffney. See the link at the bottom of the InterPress page. --IanOsgood 01:00, 14 July 2006 (UTC)

The following discussion is an archived debate of the proposal. Please do not modify it. Subsequent comments should be made in a new section on the talk page. No further edits should be made to this section.

The result of the debate was PAGE MOVED per discussion below. Even got the target right on the second try. -GTBacchus(talk) 07:07, 1 December 2006 (UTC)

Requested move[edit]

ForthForth programming language — Additionally move Forth (disambiguation) to Forth. Forth is ambiguous and until 1 April 2006 was a disambiguation page. This merely reverts the earlier move. Angus McLellan (Talk) 15:36, 24 November 2006 (UTC)


Add  * '''Support'''  or  * '''Oppose'''  on a new line followed by a brief explanation, then sign your opinion using ~~~~.
  • Support because (a) the river and firth, in particular, are very significant and it makes sense for those articles to have equal status with the programming language article; and (b) because "Forth" isn't a unanimously accepted spelling for the programming language anyway — it can be argued to be "FORTH" in capitals. Best to offset the controversy by having it at "Forth (programming language)". – Kieran T (talk | contribs) 15:50, 24 November 2006 (UTC)
  • Support - per Kierant Astrotrain 15:58, 24 November 2006 (UTC)
  • Support as a fan of both the firth and the programming language, I feel that a disambiguation page is the right solution. -- Derek Ross | Talk 07:23, 25 November 2006 (UTC)
  • Support, no clear primary topic so Forth should be dabpage. Thanks/wangi 17:41, 26 November 2006 (UTC)
  • Support, the programming language is not the first thing to spring to mind.--MacRusgail 18:50, 26 November 2006 (UTC)
  • Support - as above -- Beardo 06:09, 27 November 2006 (UTC)
  • Support as per MacRusgail FiggyBee 07:28, 27 November 2006 (UTC)
  • Support per all of above Patstuart(talk)(contribs) 01:25, 28 November 2006 (UTC)
  • Support --Stemonitis 17:11, 28 November 2006 (UTC)


Add any additional comments:

As Kieran said, it should be Forth (programming language), not Forth programming language. --Piet Delport 22:54, 24 November 2006 (UTC)

Nothing to stop the administrator who closes this taking note of the preferred move target, just so long as debate concerning that doesn't prevent this being moved to Forth (programming language) or Forth programming language, whichever is preferred. Angus McLellan (Talk) 20:05, 27 November 2006 (UTC)
The above discussion is preserved as an archive of the debate. Please do not modify it. Subsequent comments should be made in a new section on this talk page. No further edits should be made to this section.

Early Forth history[edit]

Is there a reason the article doesn't mention early Forth history? I mean the "pre-standard" era when FIG Forth and Forth Inc. were King and Queen? Isn't it curious that the article has many links to the FIG Forth site, but FIG doesn't even merit a direct mention? Also, I have several old Forth books, including Starting Forth, Thinking Forth, and Byte's Threaded Interpretive Languages. Have I just missed something, or is this info not considered important? – 2*6 05:22, 18 January 2007 (UTC)

As far as I can see, the only reason that the article doesn't talk much about early Forth history is that no editor felt knowledgable enough to add this information. It would certainly be a most valuable and important addition to the article, IMHO. —Tobias Bergemann 07:55, 18 January 2007 (UTC)
I found an excellent place to start -- The Evolution of Forth at the Forth, Inc. site. The problem is going to be condensing that information as well as having other sources so as not to be simply a synopsis of what they already did. Ack, I just checked; the article already provides a link in its History subsection of External links. Hmm, would a bulleted list of key events would fit well within the article's structure? I'm envisioning a new History section of the article which would include the bulleted list as well as include specific mention (and link) to the Evolution piece. Hesitant to just do it on an article which has received such scrutiny. – 2*6 20:55, 18 January 2007 (UTC)
Be bold! Don't be afraid to start, even with just one source (it is a very good source, nearly authoritative). Another source would be History of Programming Languages II. --IanOsgood 15:49, 21 January 2007 (UTC)
I finally took it upon myself to split out a History section. Have at it! Aside from the notable standards like the FIG-Forth model, it might be interesting to note some of the application areas where Forth found a niche, such as robotics, machine control and space probes. --IanOsgood 18:28, 5 July 2007 (UTC)

God I used to love this language. Learned it as a teenager, and became obsessed with it. Even made my own compiler in about 4 or 5 pages of Turbo pascal. There was a really fantastic book on it, thats apparently a classic, on learning Forth. Real old book, but has a chatty and informative style that just nailed down how it works. Anyone remember what that was? ('scuse the talk page hijack here :) ) Duck Monster (talk) 00:52, 21 November 2007 (UTC)

Starting Forth. Forth, Inc. just made a web version; check the article refs. Thinking Forth by the same author is also now in e-book form. --IanOsgood (talk) 17:17, 21 November 2007 (UTC)

Merge from FCode[edit]

Stub article which is directly pertinent to Forth's use in Open Firmware. A merge would be a great way of bringing implementation details into this article as opposed to it being a how-to. Chris Cunningham 09:29, 4 July 2007 (UTC)

Shouldn't this comment be on Talk: Forth (programming language) rather than Talk:Forth? — Tobias Bergemann 10:23, 4 July 2007 (UTC)
D'oh! Moving. Chris Cunningham 10:40, 4 July 2007 (UTC)
Agreed. Although the last edit to remove threaded code I believe a mistake; it's definitely a good See Also candidate, much better than (for instance) the reference to MUF (which is in error; it should really be to MUF_(programming_language)). Alex 16:09, 4 July 2007 (UTC) (see below for a change of heart Alex 22:34, 4 July 2007 (UTC))
This article is wikilinked from within the programming section so doesn't need a seealso. Chris Cunningham 08:37, 5 July 2007 (UTC)
Disagree. FCode is an implementation detail of Open Firmware. If you must merge it, merge it into Open Firmware. --IanOsgood 19:52, 4 July 2007 (UTC)
Good point; I'm going to change my vote. Disagree. Alex 22:34, 4 July 2007 (UTC)
We need more information on actual use of Forth in this article as opposed to it being a guide to syntax. I don't mind if the merge is either way, but more implementation information needs to be added to this article at some point. Chris Cunningham 08:37, 5 July 2007 (UTC)
What do you have in mind for implementation information? The major implementations are already mentioned in the info box. To be complete is impossible (if you have n Forth programmers in a room, they are likely to be using n+1 different Forth implementations, since a basic Forth is so easy to implement).
Actually, what does this article need? Is there a style guide for what topics should be covered in a programming language article? Personally, I think this article should be more of a general overview (summary, concepts, culture, history, short example) and less about syntax and implementation details. For example, the detail sections such as Forth (programming language)#Dictionary entry which use "Starting Forth" as a reference are totally obsolete. There is the WikiBook b:Forth and the many online tutorials for getting into the nitty-gritty details. --IanOsgood 16:51, 5 July 2007 (UTC)
I haven't seen an actual guide, but you're absolutely right about how it should be laid out and that's what I normally aim for. Right now we're very syntax-heavy.
For implementations I meant giving a little more time to the most common real-world implementations of Forth. At the moment most are basically just rattled though. Open Firmware is the biggie for me I suppose. Chris Cunningham 17:06, 5 July 2007 (UTC)
Found the style guide from the CS project page, and copied it into Wikipedia:WikiProject Programming languages. This article is giving way to much detail. In fact, I think everything from "Programmer's Perspective" down to "See also" should be moved to the b:Forth. The condensed concepts would fit in just a few paragraphs.
An Implementations section is suggested. The challenge for Forth is drawing the line at what constitutes major, since there as so dang many implementations out there supporting zillions of desktop and embedded platforms, compared to more centrally managed languages like Python and Ruby. I'll start it off with my shortlist. --IanOsgood 17:32, 5 July 2007 (UTC)

Removal of the "Structure of the language" section[edit]

I reverted the removal of the "Structure of the language" section. While I agree that the article can do with some major restructuring I do not agree that the section contains "hopelessly outdated and overspecific details of Forth internals", to quote IanOsgood's reasoning for the removal. At least the notion of immediate words needs to be explained as they provide the central mechanism for extension of Forth. — Tobias Bergemann 07:48, 6 July 2007 (UTC)

Very little of that section is of note to people who aren't looking to write an implementation of the language. I don't see that even the immediate words section need be saved; surely this is still an implementation detail? I agree with the removal. Chris Cunningham 08:03, 6 July 2007 (UTC)
How can immediate words be an implementation detail when they are the central mechanism of language extension for the users of the language? — Tobias Bergemann 08:16, 6 July 2007 (UTC)
Ah, right, sorry. The section is so opaque that I didn't get that. Chris Cunningham 08:33, 6 July 2007 (UTC)
Yes, drastic. But the article is much too long and documenting things which are both obsolete and that a casual reader does not care about. There is a reason that the ANS Forth standard does not specify implementation details, only behavior. If you were to split out a FORTH-83 article, then some of these implementation details like its dictionary structure would fit there.
I felt it safe to delete the IMMEDIATE stuff in that section because it is also covered more clearly in the final code example. --IanOsgood 14:56, 6 July 2007 (UTC)
I am still not convinced that complete removal of the "Structure of the language" section is a way to improve the article. However, I won't revert if you or anybody else removes that section again. — Tobias Bergemann 15:28, 6 July 2007 (UTC)
Here is my more detailed critique:
  • Programmers perspective: delete or move to the RPN article (the PostScript article also does this). Move the IF-THEN stuff to the Example section
  • Facilities: poor title (Interpreter? Basic syntax?)
  • OS, Files, Multitasking: retain only the lead sentence of each paragraph
  • Cross compilation: lead sentences only
  • Structure of the language: delete. This is describing a model which differs from Forth to Forth, so should not be described here in detail. The dictionary is also not the "basic data structure".
  • Dictionary entry: delete, likewise.
  • Structure of the compiler: delete or condense. If you must mention that control structure words are IMMEDIATE, do it in only one place.
  • Compilation state: delete, way too nitpicky for an encyclopedia article
  • Immedate: delete, already covered above, FORTH-83 obsolete standard
  • Execution tokens: keep a few sentences and C comparison
  • Parsing words: condense and move to discussion of compiler.
  • Structure of code: move threading stuff to the History section.
  • Data objects: ok. Maybe discuss Forth memory-model here.
  • Programming: good.
  • Code examples: good, but not Hello World. There is a whole page about hello world that already has Forth examples. Move the other snippets here.
  • Mixing state: ok. This is one of the big stumbling blocks of a new Forth programmer.
--IanOsgood 15:36, 6 July 2007 (UTC)
I still believe your proposed changes would remove too much valuable information. I agree that much of the content of the article as it currently stands is not relevant to modern Forth. However, I do think that what you call implementation details were (at least historically) defining characteristics of Forth in the sense that Forth traditionally meant threaded implementation and mixing state, and therefore I think these details relevent for an encyclopedic article. So, instead of completely removing this content, I would prefer to keep it but condense and integrate it into a "History" section.
Anyway, this is only my opinion. You are of course free to improve the article in any way you see fit. — Tobias Bergemann 09:05, 7 July 2007 (UTC)

"typeless" discipline?[edit]

Is it right to call Forth typeless? ANS defines several types. I think a more accurate description would be "static, no checking." Potatoswatter (talk) 11:16, 26 May 2008 (UTC)

  • Yes, typeless. The ANS types are for the human reader. Alex (talk) 23:06, 11 July 2008 (UTC)

Forth Humor[edit]

I wouldn't dare try to put this in the article but I have to at least mention the cartoon from a few decades back, with Yoda saying: "Forth programmer I am!"

I tinkered a bit with Forth back in the 1980s -- surprised to see it alive and well, I thought it was dead. I'll have to get back to it again. MrG (talk) 14:34, 11 June 2008 (UTC)

Definition example[edit]

It seems to me that a better example of a definition could be found. The current one is : X DUP 1+ . . ; . It's a little confusing, as it's not quite clear what the function is supposed to do. I think we might want to show off a more obvious function, for example : DOUBLE DUP + . ; . That way, the reader can intuit the purpose of the code, and not have to spend time figuring out the intent of the function. Quentin mcalmott (talk) 07:34, 9 July 2008 (UTC)

NASA Usage[edit]

Wouldn't it be worth to link to ? (talk) 12:49, 9 July 2008 (UTC)

Wow, nice link! Don't be afraid to be wp:bold with such contributions. Potatoswatter (talk) 01:00, 10 July 2008 (UTC)
 Done. Great link. It's now the reference for the sentence "Forth has a niche both in astronomical and space applications." -- (talk) 16:34, 29 January 2009 (UTC)
Sadly, that link was removed by IanOsgood 18:51, 2 March 2009. I shure liked that link back. It clearly shows a niche where Forth is used much. That page is a bit old though. Johan G (talk) 20:14, 2 March 2009 (UTC)
Not at all! It was promoted to a full reference, in the opening section no less! (Every external link dreams of growing up to be a full reference.) --IanOsgood (talk) 01:45, 3 March 2009 (UTC)

did not influence PostScript[edit]

Page vii, PostScript Language Reference Manual: "Design System language and its successors (PostScript) bear a superficial resemblance to the FORTH programming language, their conception and development wer entirely independant of FORTH." Jeffz1 (talk) 02:57, 21 July 2008 (UTC)

Looking at the only version of the Language Reference I could find, the only mention of Forth is on page 23, where the entire paragraph is as follows:

Like all programming languages, the PostScript language builds on elements and ideas from several of the great programming languages. The syntax most closely resembles that of the programming language FORTH. It incorporates a postfix notation in which operators are preceded by their operands. The number of special characters is small and there are no reserved words.

I can't find the quote you have anywhere. In fact, in the index, it lists FORTH with the note "as PostScript influence". It seems to be the opposite of what you've suggested. Do you have an earlier version of the Language Reference? The one I found is the third. Quentin mcalmott (talk) 21:39, 23 July 2008 (UTC)

Yes, it's in the original publication of the PostScript Language Reference Manual, so far as I'm aware this is not online, only in print. The quote in the third edition says that it only "resembles" it does not actually say it was influenced by. In contrast, the quote from the first edition specifically says that the resemblance is only superficial and their conception, development were entirely independant of FORTH.

I've found this through google books: Jeffz1 (talk) 01:56, 24 July 2008 (UTC)

In the index of the third edition, it lists forth "as PostScript influence".
Obviously Postscript isn't Forth, but I wish we could get a better quote on it from someone that designed it. Quentin mcalmott (talk) 20:38, 24 July 2008 (UTC)

Postscript isn't Forth. Postscript was designed by many people, many of whom had probably used Forth. It was also designed by people who had used Lisp. Considering we have no standards for what an "influence" is or isn't, the statement that one language influenced the other is pretty much meaningless, even if an original PS developer made it. To someone unfamiliar enough with Forth to think that its defining quality is postfix notation, they might seem similar. Truly, both can be parsed using a negligible amount of memory. But Forth is distinguished by having two stacks, no "native" local variables, and explicitly interactive compilation, none of which PS has. Moreover, any infix or prefix language such as C or Lisp can trivially be translated to postfix. I personally learned that in my first month of compiler class, which possibly didn't even mention Forth. Therefore, let's not grasp at nebulous statements. We do know the two languages are semantically unrelated, and it's bad journalistic/historical practice to scour the record for a particular statement, in order to report it as truth. Potatoswatter (talk) 20:57, 24 July 2008 (UTC)

Potatoswatter's reasoning is fine with me, but its consequence is that the 'Influences' and 'Influenced' tags in the article header are in fact inappropriate. I would be in favor of replacing them with a 'Similar' field, limited to say five items.Mhx (talk) 07:45, 25 July 2008 (UTC)

Forth20x0 standard[edit]

The iForth FAQ page, <>, hints at a "Forth20x0 standard". Perhaps this proposed or completed standard, if it exists, should be described?

2008-08-12T22:56:00Z, Mortense (talk) 22:50, 12 August 2008 (UTC)

<> is where the new standard is being developed, I think it would be good to have that link somewhere Donio (talk) 03:12, 27 November 2008 (UTC)

That is a tongue-in-cheek remark, designed to put some pepper in the committee members' pants. Unfortunately, they're all wearing flame-proof underpants and hair shirts. Mhx (talk) 17:46, 13 August 2008 (UTC)

Perhaps we should also include a reference to the official Standard, I would prefer ISO/IEC 15145:1997, but ANSI X3.215-1994 would be acceptable PjK (talk) 12:54, 1 February 2014 (UTC)

Stacks and subroutines[edit]

For what it's worth, rewriting the code to use continuation passing style isn't the only alternative to the conventional call stack when implementing subroutines. On many old computers subroutines were implemented by saving the return address in a register or into a location before the subroutine. These implementations didn't generally support recursive subroutines, but they did support subroutines and they didn't use a call stack.

Systems based on expression rewriting are also able to support subroutines without a call stack. At each stage of evaluation, subroutine calls in the expression being evaluated are replaced by the body of the subroutine. They aren't popular, and most of the ones that I have seen were primarily meant for educational purposes, but they do exist. Kleg (talk) 19:20, 27 January 2009 (UTC)

A stack (data structure) is any LIFO data structure. Subroutines execution necessitates "pushing" and "popping" activation records. Any flow control which qualifies as subroutines with activation records manages a data structure which may be interpreted as a stack. The stack may be a linked list or limited to one or two entries, but it's still a stack.
Continuation-passing style is not only a programming style, but also the continuation is a formalism encompassing all flow control including subroutines. Interpreted in this manner, subroutine flow control still necessitates a stack structure being around. Potatoswatter (talk) 19:32, 27 January 2009 (UTC)

I still disagree that "All" computer languages use a stack for subroutine flow control, given the additional counter-example of lazily-evaluated languages such as Haskell and Kleg's call-through-rewriting example (which is one way of implementing lazy evaluation).

Given that computer languages exist that at least conceptually invoke functions without the use of a stack, the objection to the word "Most" seems puzzling. Hdan (talk) 21:03, 27 January 2009 (UTC)

I have to agree that "many" or "most" is more accurate wording than "every". Note that even Subroutine#Call_stack is worded that way:
"Most modern implementations use a call stack, a special case of the stack data structure, to implement subroutine calls and returns."
I say this as a staunch Forth advocate. --IanOsgood (talk) 21:14, 27 January 2009 (UTC)
Note the exact wording (not that that article is necessarily perfectly worded): … use a call stack, a special case of the stack data structure … . A call stack is a different beast and cannot be a linked list.
Lazy evaluation is a totally different paradigm from subroutines. You guys are throwing around lots of arguments about supposed "special cases" but missing the definition of a subroutine. A subroutine is when you jump to a point in code, (maybe) activate local variables and do something, and jump back. Simply because some languages have other capabilities or optionally bypass or hack the stack structure, doesn't mean they don't have a stack. Re-read the definition of a subroutine and consider whether activation records can be linked in any way other than a stack, under conditions of subroutine execution. I don't think this argument has much to do with Forth. Potatoswatter (talk) 23:32, 27 January 2009 (UTC)
The paragraph in question also says "call stack." Kleg (talk) 23:35, 27 January 2009 (UTC)
Sorry, missed that — fixed. All good now? Potatoswatter (talk) 00:27, 28 January 2009 (UTC)
Many early machine architectures didn't have a hardware stack. When programming for such a machine, subroutines would be implemented by A writing to a variable "B's return address" [or, equivalently, directly modifying B's returning jump instruction] and then jumping to B. (This doesn't allow recursion, but these are still typically considered subroutines.) One might argue that this arrangement is still conceptually a stack insofar as it allows LIFO call flow (so long as no recursion is involved), but it is usually considered distinct from a stack precisely because a true stack would support recursion. (Incidentally, it also supports un-stack-like operations such as accessing X's return address regardless of where X is in the "call stack" or even if X has already returned.)
Not only is the statement that "subroutines require a stack" questionable, it is also unnecessary in this context, and I have thus removed it and reworded the remainder. —Preceding unsigned comment added by Pjrm (talkcontribs) 02:21, 22 October 2009 (UTC)
Potatoswatter, the general definition of a subroutine is a section of code which performs a function which the programmer considers to be useful. There are two types. One is a closed subroutine which is the type you describe. Processing jumps to the subroutine and returns where it came from afterwards, as you describe. The other is an open subroutine where the section of code is embedded in something else, i.e. the subroutine is written out in full where it's needed. Most programmers use closed subroutines for moderate to substantial functions, and use open subroutines for trivial functions. 20:58, 5 February 2011 (UTC) (talk) 21:02, 5 February 2011 (UTC)
"Open subroutine" does not appear on that page. If a programmer copy-pastes lines of code which are commonly useful, that is not a subroutine. Likewise I think most programmers would disagree that code generated by a macro (computer science) is a subroutine. On the other hand, I think most would classify an inline function as such. I don't think it's meaningful to say what "most programmers" do. It is best to liberally use whatever abstractions your language provides, and avoid copy-paste, whatever your coworkers do. Anyway, do you have a point at all, and does it relate to Forth? Potatoswatter (talk) 04:24, 6 February 2011 (UTC)
  • A stack is any LIFO structure. LIFO control flow implies a LIFO structure in memory somewhere, even if it's in the form of a linked list between fixed addresses with one node per function.
  • Sometimes Forth has local variables. Potatoswatter (talk) 01:22, 23 October 2009 (UTC)

Better code examples[edit]

I suppose this may raise the ire of staunch Forth devotees, but several times in the past I have thought about dabbling in Forth -- just for curiosity's sake -- and been put off by the code examples. It seems that Forth code examples tend to jump directly from the completely trivial (e.g. EMIT-Q, HELLO) to stuff sufficiently abstruse as to put off anyone not already determined to learn Forth.

And this article's examples have shaped up the same way. In comparison most other languages publish plenty of intermediate pedagogical examples. Compare, for example, the following programming language examples here on Wikipedia:

  • Java includes repeatedly fetching a number from a user (through a GUI), and informing the user if the number is even or odd
  • Python gives many examples, including a function to generate lists of prime numbers
  • Our Perl articles are actually a bit weak in this regard too, but do include a factorial function
  • JavaScript implements the Euclidean algorithm to find lowest common multiples

So when people look at the Forth article and see EMIT-Q, I suspect they are thinking (as I often have) "not only is this language only suited to writing device drivers, but even for that it must be like squeezing blood from a stone."

Sounds good to me. If you feel strongly about this, how about proposing some standard examples that could be used across all programming language articles? Wikipedia:WikiProject Programming Languages has a style guide where the standard examples could be documented. --IanOsgood (talk) 15:46, 1 October 2009 (UTC)

As I am not a Forth programmer, I am not able to provide an alternative, but I would suggest that if none of the above examples are suitable, then it seems to me that the RC4 cipher might be particularly amenable to a simple Forth implementation. -- (talk) 07:36, 24 September 2009 (UTC)

Like this?

0 VALUE tmp
0 VALUE ii
0 VALUE jj

: ARCFOUR  ( c -- x )
	ii 1+ DUP TO ii #255 AND		( -- i )
	S[] +  DUP C@			( -- 'S[i] S[i] )
	DUP jj +  #255 AND DUP TO jj	( -- 'S[i] S[i] j )
	S[] +  DUP C@ TO tmp		( -- 'S[i] S[i] 'S[j] )
	OVER SWAP C!      		( -- 'S[i] S[i] )
	tmp ROT C!			( -- S[i] )
	tmp +				( -- S[i]+S[j] )
	#255 AND S[] + C@			( -- c x )
	XOR ;

: ARCFOUR-INIT	( key len -- )
	#256 UMIN LOCALS| len key |
	#256 0 DO  I  S[] I + C!  LOOP
	0 TO jj 
	#256 0 DO			( key len -- )
		  key I len MOD + C@  
		  S[] I  + C@  + jj + #255 AND TO jj
		  S[] I  + DUP C@  SWAP ( c1 addr1 )
		  S[] jj + DUP C@  ( c1 addr1 addr2 c2 ) ROT C! C!
	0 TO ii  0 TO jj ;

Mhx (talk) 20:15, 25 September 2009 (UTC)

Thanks, excellent work! Do please put it in! -- (talk) 04:11, 1 October 2009 (UTC)
If it were me, I'd replace the global value "tmp" with an anonymous local on the return stack:
: ARCFOUR  ( c -- x )
	S[] +  DUP C@ >R		( -- 'S[i] S[i] 'S[j] )
	OVER SWAP C!      		( -- 'S[i] S[i] )
	R@ ROT C!			( -- S[i] )
	R> +				( -- S[i]+S[j] )
Also, I don't think the prefixed decimal literals (#256) or UMIN are standard. Just 256 and MIN should work fine. --IanOsgood (talk) 15:37, 1 October 2009 (UTC)
While I appreciate the work in this, if I wanted to have an example that would put people off using Forth, this would be the sort of thing I'd pick. I'll have a think about something that is more understandable by people not familiar with the language while also showing its strengths (like encouraging factorisation) Lovingboth (talk) 12:16, 21 June 2011 (UTC)


"Forth was the first resident software on the new Intel 8086 chip in 1978 and MacFORTH was the first resident development system for the first Apple Macintosh in 1984."

What is resident software and what is a resident development system? --Abdull (talk) 13:46, 28 January 2010 (UTC)

"Resident" means the Forth system ran entirely on the target platform itself. In most cases, bringing up experimental hardware requires some sort of cross-compiler or umbilical system where the bulk of the target development is done on a different computer. For example, most of the original Macintosh development was done on its predecessor, the Apple Lisa. --IanOsgood (talk) 16:51, 28 January 2010 (UTC)

F79 de facto standard[edit]

It is more precise to call figForth a de facto standard and F79 a failed standardisation attempt. Can you call F79 and f83 a "de facto" standard, if they are formal standardisation attempts? That doesn't seem right from a language point of view. (talk) —Preceding undated comment added 13:14, 15 February 2011 (UTC).

"Forth does not use a BNF grammar"?[edit]

I was about to delete this but thought I'd better check first. BNF is a way of writing out a context-free grammar and it must be possible to have a stab at writing a BNF grammar for FORTH. So when the article says "Forth does not use a BNF grammar" I don't know what it means. The context seems to be that you can modify the language without having to recompile the compiler, but that doesn't explain the mention of BNF. GeorgeMacro (talk) 18:25, 25 June 2011 (UTC)

Forth does not have a context-free grammar, so no BNF. Quoting John Passanti: "...Forth's grammar isn't defined at the language level, but at the level of the words that comprise Forth. Each whitespace-separated word in Forth can impose it's own syntax and semantics, and these can be nearly anything. This makes it difficult to express in a BNF grammar because each lexical element can do nearly anything it wants (although there are sensible conventions most people stick with)." (see this thread in comp.lang.forth) --IanOsgood (talk) 22:20, 25 June 2011 (UTC)
That's a good thread. I've edited the article to say "Forth's flexibility makes a static BNF grammar inappropriate" GeorgeMacro (talk) 18:13, 26 June 2011 (UTC)

code example FLOOR5[edit]

I think the in the code example to FLOOR5 there should be an additional DROP. Can someone verify this?

: FLOOR5 ( n -- n' ) DUP 6 < IF DROP 5 ELSE DROP 1 - THEN ;

Georg Stillfried (talk) 10:21, 30 July 2013 (UTC)

I don't think so: after the IF-ELSE the stack will be as it was before the beginning of the word, and the minus consumes two stack items. —Tobias Bergemann (talk) 12:49, 30 July 2013 (UTC)

Balance of maintenance section[edit]

The [1] section seems to be lacking balance. Although all the facts there may be true, it is also true that Forth is not widely used outside of particular niches, and there are reasons for that, many of them probably to do with maintainability. It would be good to formulate a neutral justified statement of what they are.Subsolar (talk) 23:58, 22 December 2013 (UTC)

Adding "Make" to influenced list[edit]

This might be considered original research, but I'm sure that anyone who has ever used either GNU or Berkeley Make, (particularly the latter, as I have) as well as FORTH, will immediately notice that while simplified, syntactically Make is almost identical. Given my negative experiences with Wikipedia in the past, I will not attempt to add this myself; but I leave the idea here, for someone who considers themselves entitled to do so.

Petrus4 (talk) 11:33, 30 January 2014 (UTC)

These two languages are really nothing alike and make is not syntactically similar, nor semantically, and they have completely different goals. Make was designed as one of many of the Unix mini-languages (like sed or awk) to do one task and to do it well, which is to order and build dependencies while doing the least amount of work. FORTH is a programming language with no set grammar, as it is possible to modify the FORTH grammar in FORTH, it is not possible to do that in make.

Defensiveness and language comparisons[edit]

This article reads very defensively, as if Forth can only be discussed in relation to how it's misunderstood, lesser used, or otherwise somehow compared with C. Let the language speak for itself! Just state the facts! The in-line talk of "most" or "other" languages and and self-deprecating statements should go away. I'll fix what I can, but let this stand as a reminder for future editors. Dgpop (talk) 17:15, 19 March 2015 (UTC)

"Non-commercial" removal[edit]

mhx removed a link to '8th'. I would like to know on what basis.

His comment is about "Removed references to obscure, outdated, or certainly non-standard implementations", but only 8th was removed. Well why? Factor is definitely non-standard. SwithForth is definitely commercial. RonAaron (talk) 13:13, 30 October 2015 (UTC)

Forth history ends in the 80's[edit]

The history section ends in the 80's. No mention of the ISO 1994 standard. no mention of landings on comets, Forth processors. Really? Overall this wiki article show a weak balance between relevant and less relevant subjects. — Preceding unsigned comment added by (talk) 15:54, 3 November 2016 (UTC)

External links modified[edit]

Hello fellow Wikipedians,

I have just modified 3 external links on Forth (programming language). Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

As of February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete the "External links modified" sections if they want, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{sourcecheck}} (last update: 15 July 2018).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 10:12, 3 January 2017 (UTC)

External links modified[edit]

Hello fellow Wikipedians,

I have just modified 7 external links on Forth (programming language). Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

As of February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete the "External links modified" sections if they want, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{sourcecheck}} (last update: 15 July 2018).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 16:06, 4 October 2017 (UTC)