3 ms·
There's no docs or implementation, but I'd say that `.` in Forth is a generic way to print something, and `emit` may do more work, like HTML escaping.
by nine_k 5mo ago
There's no docs or implementation, but I'd say that `.` in Forth is a generic way to print something, and `emit` may do more work, like HTML escaping.
- wizzwizz4 5mo agoIt looks like it's the opposite: `.` does HTML escaping, whereas `emit` is raw.
- FarmerPotato 5mo agoDot is Forth convention for "print" where a single . means print integer. .S (pronounced "dot S" or "print S") is for strings. Both expect input from the stack. ." Begins a literal string you want printed immediately. .S is a word that prints the stack (not destructively) pronounced "print stack" EMIT in Forth prints one ASCII character (which byte value comes from the stack). You are free to redefine whatever you like --it's your own language! Most of the punctuation in Forth has conventional meanings that help (a little) reading comprehension. DECIMAL : STAR 42 EMIT ; : STARS ( n -- ) 0 DO STAR LOOP ; Type 5 STARS ***** ok