IRC Log - 2025-03-02 - ##forth

Channel: ##forth
Total messages: 88
Time range: 19:44:07 - 23:43:53
Most active: cleobuline (26), ForthBot (26), xentrac (17)
19:44:07 ##forth <user51> I think I'll go for NUL-terminated strings in my forth, arguments for/against NUL-terminated/counted welcome.
19:45:26 ##forth <xentrac> while I do not share your preference, I doubt it's because I know something you don't ;)
19:46:21 ##forth <xentrac> I think that counted strings are more of a pain in C, where you don't have multiple return values, than in Forth
19:50:51 ##forth <user51> Yeah, using C is probably a factor. I even ran into problems with strncmp which may or may not be relevant.
19:53:21 ##forth <user51> The problems were (1) it's a string function, so it terminates on the first NUL (2) but it also takes n, but NUL has precedence (3) it checks the prefix, so it might return 0 implying equality for different strings (4) what do you think strncmp(s1,s2,0) should do? and finally (5) it's on the same manpage as strcmp, despite being significantly different
20:14:42 ##forth <xentrac> yeah, there's no standard library support for counted strings in C
20:21:40 ##forth <MrMobius> you also have to pick a maximum size with counted strings or use a variable encoding for the length
20:23:41 ##forth <xentrac> oh, I definitely do not endorse the count-byte representation used by C" introduced in Forth-83
20:23:57 ##forth <xentrac> by "counted string" I only meant c-addr u on the stack
20:24:08 ##forth <xentrac> or in a 2variable or whatever
20:24:17 ##forth <xentrac> then your maximum size is the size of memory
20:25:28 ##forth <amby> xentrac: there's some
20:26:25 ##forth <amby> but yeah there's no counted atoi for example afaik
20:27:23 ##forth <xentrac> also no counted strcmp, no counted strcpy, no counted strcat, etc.
20:27:35 ##forth <xentrac> you might think memcmp is a counted strcmp
20:28:13 ##forth <amby> i mean counted strcpy is memcpy
20:28:17 ##forth <xentrac> but no, if you have two counted strings of different lengths, memcmp will not tell you which of them comes first asciibetically. it doesn't even have enough arguments to take both of their lengths
20:28:47 ##forth <amby> how does strcmp deal with different lengths?
20:29:04 ##forth <user51> doesn't memcmp perform similarly to strncmp, except without a nul terminator check?
20:29:07 ##forth <amby> or more specifically, if one string is a prefix of the other, which one comes first?
20:29:08 ##forth <xentrac> if one string is a prefix of the other, that one is considered to be "less than"
20:29:37 ##forth <amby> so memcmp the shorter string against the same length of the other string
20:29:44 ##forth <xentrac> memcpy, like memcmp, doesn't have enough arguments to take the lengths of both arguments
20:30:56 ##forth <xentrac> yes, you can of course write your own counted strcmp and strcpy and so on with the C primitives
20:30:56 ##forth <xentrac> what I'm saying is that you have to
20:32:04 ##forth <xentrac> in current C, which has by-value struct arguments, it's even a practical thing to do; it wasn't in early versions of C, where struct arguments were by reference
21:15:29 ##forth <cleobuline> ForthBot: STRING HELLO
21:15:56 ##forth <cleobuline> ForthBot: HELLO " Hello World !"
21:16:14 ##forth <cleobuline> ForthBot: HELLO @ PRINT
21:16:46 ##forth <cleobuline> ForthBot: HELLO " Hello World !" S!
21:16:52 ##forth <cleobuline> ForthBot: HELLO @ PRINT
21:16:52 ##forth <ForthBot> Hello World !
21:17:26 ##forth <cleobuline> ForthBot: 72 EMIT 73 EMIT CR
21:17:26 ##forth <ForthBot> HI
21:17:54 ##forth <cleobuline> ready to print ascii art :)
21:19:04 ##forth <cleobuline> ForthBot: LOAD 'test.fth"
21:19:04 ##forth <ForthBot> LOAD expects a quoted filename
21:19:17 ##forth <cleobuline> ForthBot: LOAD "test.fth"
21:19:17 ##forth <ForthBot> Unknown word: RECURSE
21:19:18 ##forth <ForthBot> Definition failed for FACT: compilation error
21:20:25 ##forth <cleobuline> ForthBot: LOAD "test.fth"
21:20:25 ##forth <ForthBot> Unknown word: RECURSE
21:20:25 ##forth <ForthBot> Definition failed for FACT: compilation error
21:36:39 ##forth <cleobuline> something is broke :(
21:56:58 ##forth <cleobuline> ForthBot: LOAD 'test.fth"
21:56:58 ##forth <ForthBot> LOAD expects a quoted filename
21:57:03 ##forth <cleobuline> ForthBot: LOAD "test.fth"
21:57:04 ##forth <ForthBot> MOT DEFINIS :
21:57:04 ##forth <ForthBot> HELLO DOUBLE FACT POW FIBONACCI COUNTDOWN TUCK 2DROP SUM_SQUARE CUBE SUM_CUBES RECUNACCI
21:57:05 ##forth <ForthBot> Stack: 30
21:57:05 ##forth <ForthBot> Others
21:57:05 ##forth <ForthBot> MOTS DEFINI :
21:57:06 ##forth <ForthBot> HELLO DOUBLE FACT POW FIBONACCI COUNTDOWN TUCK 2DROP SUM_SQUARE CUBE SUM_CUBES RECUNACCI TRIPLE POW2 TEST-CASE
21:57:07 ##forth <ForthBot> test2.fth loaded !
21:57:13 ##forth <cleobuline> kool
21:57:36 ##forth <cleobuline> ForthBot: SEE FACT
21:57:45 ##forth <cleobuline> lol
23:16:21 ##forth <cleobuline> ForthBot: LOAD "test.fth"
23:16:21 ##forth <ForthBot> MOT DEFINIS :
23:16:21 ##forth <ForthBot> Stack: 30
23:16:22 ##forth <ForthBot> Others
23:16:22 ##forth <ForthBot> MOTS DEFINI :
23:16:23 ##forth <ForthBot> HELLO DOUBLE FACT POW FIBONACCI COUNTDOWN TUCK 2DROP SUM_SQUARE CUBE SUM_CUBES RECUNACCI TRIPLE POW2 TEST-CASE
23:16:24 ##forth <ForthBot> test2.fth loaded !
23:16:39 ##forth <cleobuline> ForthBot: SEE FIBONACCI
23:16:40 ##forth <ForthBot> : FIBONACCI DUP 0 = IF DROP 0 EXIT DUP 1 = IF DROP 1 EXIT DUP 2 = IF DROP 1 EXIT 1 1 ROT 2 - 0 DO OVER + SWAP LOOP DROP THEN ;
23:18:44 ##forth <vms14> ForthBot: ." :D"
23:18:44 ##forth <ForthBot> :D
23:19:09 ##forth <vms14> ForthBot: : :D ." :D" ;
23:19:16 ##forth <vms14> ForthBot: :D
23:19:16 ##forth <ForthBot> :D
23:19:17 ##forth <xentrac> yay! see!
23:19:22 ##forth <xentrac> ForthBot: SEE :D
23:19:22 ##forth <ForthBot> : :D ." :D" ;
23:19:30 ##forth <vms14> :D
23:22:23 ##forth <cleobuline> yes !
23:28:52 ##forth <cleobuline> ForthBot: : CAT 32 EMIT 32 EMIT 32 EMIT 47 EMIT 95 EMIT 47 EMIT 32 EMIT CR 40 EMIT 32 EMIT 111 EMIT 46 EMIT 111 EMIT 32 EMIT 41 EMIT CR 32 EMIT 32 EMIT 62 EMIT 32 EMIT 94 EMIT 32 EMIT 60 EMIT CR ;
23:29:04 ##forth <cleobuline> ForthBot: CAT
23:29:04 ##forth <ForthBot> /_/
23:35:09 ##forth <cleobuline> vms14 they may be some bugs still
23:35:16 ##forth <vms14> lol
23:35:33 ##forth <vms14> it has cats, what else could we ask for
23:35:44 ##forth <cleobuline> yes !
23:36:13 ##forth <vms14> it's funny how we had 0 bots and now we have 3
23:36:37 ##forth <vms14> if my abomination wasn't so different I would add mine too
23:36:47 ##forth <cleobuline> it's funny to build forthbot :)
23:38:05 ##forth <cleobuline> until you do not make word to read and write the host memory :)
23:43:53 ##forth <cleobuline> if you do that it can be turned in a nightmare