BL

( -- char )

char is the character value for a space.

See:

Rationale:

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.

Testing:

T{ BL -> 20 }T

ContributeContributions

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

$20 CONSTANT BL

GeraldWodniavatar of GeraldWodni

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

BerndPaysanavatar of BerndPaysan

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

AntonErtlavatar of AntonErtl

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).

mcondronavatar of mcondron

It's always handy to have readable references for things like TAB, CR, LF, ESC, etc. This word could be optional, but it's certainly handy.

PeterKnaggsavatar of PeterKnaggs

BL has been in Forth since 1976, the rational in the '79 document is:

Leave the ASCII character value for blank (decimal 32).

It was originally included as you can not use CHAR or [CHAR} to obtain the value. We have kept it in the standard for backward compatibility.

If you must have a reference implementation, I would use:

DECIMAL 32 CONSTANT BL

Particularly given the prefix notations are optional.

AntonErtlavatar of AntonErtl

AFAICS, number prefixes are obligatory in Forth-2012, so either reference implementation is ok.

Reply New Version

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

SPACE is an obvious example of how to use BL:

: SPACE ( -- ) BL EMIT ;

GeraldWodniavatar of GeraldWodni

Thank you for your example, it is deemed valid and therefor closed.

Closed
Reply New Version

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

This contribution has been moved to the proposal section.

BerndPaysanavatar of BerndPaysan

This reply has been moved to the proposal section.

ruvavatar of ruv

This reply has been moved to the proposal section.
Reply New Version

mcondronavatar of mcondron Test example numeric base?Request for clarification2019-08-01 00:27:14

The test example shows BL being 20. From looking at the test suite code, it seems to mostly be in decimal. Maybe I need to get better acquainted with the test harness, but shouldn't this be 32? Decimal?

AntonErtlavatar of AntonErtl

Hayes' core.fr starts with HEX. Now that we have standardized number prefixes, we could use number prefixes (e.g., $20) to eliminate this dependence on BASE.

ruvavatar of ruv

I think, regardless other third party files, numbers in the specification should be in decimal by default. The test suit from Annex F restores BASE after loading.

Also, in other places the decimal radix is implied. E.g. the tests for +LOOP.

Reply New Version