Sujet : Re: "The Best Programming Language for the End of the World"
De : dxforth (at) *nospam* gmail.com (dxf)
Groupes : comp.lang.forthDate : 05. Apr 2025, 04:48:10
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <cf9dc70297223ad4a39ba1a4ba2c072c8737e306@i2pn2.org>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 4/04/2025 10:36 pm,
albert@spenarnc.xs4all.nl wrote:
In article <nnd$4e8dcfed$6eb3f489@d30798298ac0a139>,
Hans Bezemer <the.beez.speaks@gmail.com> wrote:
On 27-03-2025 06:05, Alexis wrote:
...
"I've looked at a lot of Forth code, and it's almost uniformly
doc-free." That's an attitude problem - not a language problem.
I agree. Most programmers agree that ( -- ) is sufficient documentation.
My advice is : precede each word with a specification that allows
the use of this word. The ideal is that the definition itself is
in fact the documentation of the definition. This is Chuck Moore's
pipe dream.
I'm not so sure. 10 definitions and 2 comments. Does it need more?
\ Encountered file error, display msg, filename then quit
: FERR ( ? ior a u -- ? ) rot 0= if 2drop end
cr ." File error: " type ." - " @fname type abort ;
: FOPEN ( a n fam -- ) open-file s" open" ferr cf ! ;
: FCREAT ( a n fam -- ) create-file s" create" ferr cf ! ;
: FREAD ( a n -- n' ) cf @ read-file s" read" ferr ;
: FWRITE ( a n -- ) cf @ write-file s" write" ferr ;
: FSEEK ( ud -- ) cf @ reposition-file s" position" ferr ;
: FCLOSE ( -- ) cf @ close-file s" close" ferr ;
\ Install terminal data at offs to target at adr
: SET.S ( a ofs -- ) dbuf + count rot >target place ;
: SET.W ( a ofs -- ) dbuf + @ swap >target ! ;
: SET.B ( a ofs -- ) dbuf + c@ swap >target c! ;