( -- char )

char is the character value for a space.



Because space is used throughout Forth as the standard delimiter, this word is the only way a program has to find and use the system value of "space". The value of a space character can not be obtained with CHAR, for instance.


T{ BL -> 20 }T


BerndPaysanavatar of BerndPaysan ASCII version of BLSuggested reference implementation2015-11-27 19:14:22


GeraldWodniavatar of GeraldWodni 2015-11-27 19:18:57

If it is so somple to implement, should it really be in the standard?

BerndPaysanavatar of BerndPaysan 2015-11-27 19:22:55

BL is more readable than $20, just as CHAR * is more readable than 42.

AntonErtlavatar of AntonErtl 2015-12-04 17:07:31

But is it necessary to have BL in core?

The rationale is written for an encoding-independent standard, but the standard ('94 and 2012) specifies that we use ASCII-compatible encodings, so we actually do have a way to do without BL (not as readable, but still).


BerndPaysanavatar of BerndPaysan An exampleExample2015-11-29 23:58:06

SPACE is an obvious example of how to use BL:

: SPACE ( -- ) BL EMIT ;

AntonErtlavatar of AntonErtl BL rationale is wrongProposal2017-10-25 11:35:46

Both Forth-2012 and Forth-94 specify ASCII as character encoding, so we know that the value of BL is #32 (or $20). The rationale claims that BL is the only way to get this value, but it is wrong.

BerndPaysanavatar of BerndPaysan 2017-10-25 13:15:11

Indeed, so we could move BL to core ext to make it optional.

There's no need for a size constrained system to contain a word that's trivially replaced by a literal with known value.