13

I have seen people save Forth source code files with the extensions .4th, .fth, .frt and .f. Which is the most common filename extension of Forth source code files?

Sled
  • 18,541
  • 27
  • 119
  • 168
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299

3 Answers3

16

I searched for various file extension on GitHub (plus "dup drop swap"), and this was the result:

  1. .fs 4783 hits
  2. .fth 1144
  3. .4th 509
  4. .f 398
  5. .fr 143
  6. .4 55
  7. .frt 46
  8. .scr 30
  9. .forth 20
  10. .ft 11
  11. .fb 4
  12. .blk 2
  13. .seq 1
  14. .ans 1
  15. .for 1
  16. .fo 0

If nothing else, this shows there are many file extensions to chose from.

Lars Brinkhoff
  • 13,542
  • 2
  • 28
  • 48
  • 3
    Today "dup drop swap in:file extension:fs" = 31 376 and "dup drop swap in:file extension:txt" = 17783 and .fth = 6086 - c: – skvery Aug 20 '17 at 00:00
  • 2
    Be careful , some use the convention that `.fs`is a FORTH screen file (not really text, a sequence of 16 line 64 character "screens") – vonbrand Jul 05 '18 at 20:20
  • 1
    Conflicts: `.fs` - F#, `.fth` - FileMaker theme, `.f` and `.for` - Fortran. The most popular non- conflicting extension listed is `.4th`. The most obvious extension would be `.forth`, but I guess Forth is still often used with file systems requiring a 3-character extension and `.4th` would fit that criterion as well. – Lassi Feb 12 '20 at 19:35
5

Inspired by Lars Brinkhoff's answer, I ran some queries myself on GitHub to find out how the various extension names are used between various languages (not just Forth). For each extension in the list below, only the top 3 languages with the highest number of results are shown:

The results above were obtained on 13 May 2021 at 15:30 UTC.

Note: GitHub sometimes detects the wrong language for source code files. The above queries attempt to reduce the impact of such errors on the results above but they aren't perfect.

Conclusions:

  • The most popular extension for Forth source code appears to be .fs but the extension .fs is most often used for F#. In fact there are about twice as many F# source code files with this extension as there are for Forth.
  • The most popular extension for Forth source code that does not appear to be used for any other language is .fth.
  • The extensions .4th, .frt, and .forth also do not appear to be used for any other language, however, these extensions are less popular than .fth.
Susam Pal
  • 32,765
  • 12
  • 81
  • 103
3

Gforth advocates .fs in its documentation, which is a pretty good standard for such things.

sheepez
  • 986
  • 1
  • 10
  • 26