Proposal: [250] Formatting: spaces in data type symbols


This page is dedicated to discussing this specific proposal


ruvavatar of ruv [250] Formatting: spaces in data type symbolsProposal2022-08-12 15:04:29



Change Log

  • 2022-08-12 Initial version


In Forth-94 no data type symbol contain a space. In Forth-2012 some data type symbols contain spaces, so stack diagrams are worse read.

Some examples


( i*x xt -- j*x )
( n1|u1 n2|u2 -- n3|u3 ) 


( i * x xt -- j * x )
( n1 | u1 n2 | u2 -- n3 | u3 ) 


Remove spaces from data type symbols.


Everywhere in the text of the standard replace u | n, u_ | n_, i * x, j * x, k * x by u|n, u_|n_, i*x, j*x, k*x correspondingly.

ruvavatar of ruv

Additional reasonings.

  1. According to data type symbols, u|n is a single data type symbol. It's confusing when this data type symbol contains spaces, when most data type symbols don't contain spaces. The same is true for i*x, etc.

  2. A bar character | is also used to represent alternates for the whole tuple of stack-parameter data types; for example see FIND ( c-addr -- c-addr 0 | xt 1 | xt -1 ). If we represent u|n as u | n (i.e, with spaces around the bar), it looks like alternative for the whole tuple of data types, but it's wrong.

Reply New Version