Usually #CR, #LF, #BS, #TAB...
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/
> Usually #CR, #LF, #BS, #TAB...
Bernd's answer is good. My solution, used in Neil Bawd's
cite, is clarity.
There should be no doubt of the meaning of
dup #eol-char = swap #linefeed-char = or
I read a leading "#" before a singular noun as "the". Before
a plural noun as "number of". `
I have a vague theory of clarity as inverse to the number of
steps to get from text to understanding. "#BS", ..., require
an extra step of knowing the usual symbols for the control
characters, and another slight step to recognizing these
words are constants for characters
--
Wil
where the # indicates a decimal number.
I then find code phrases like "<CR> = if ..." scattered around. i.e.
these constants are ALWAYS followed by an equals.
In these cases I go back and remove the constants and define words such
as
: CR? #13 = ;
: DEL? #127 = ;
I like words ending with a question mark indicating that the result of a
test is returned.
Graham Smith
C#CR C#LF C#BS
> OK, this is bugging me. I'm trying to clean up some old code and
> have the following definitions:
> 8 constant =BS
> 10 constant =LF
> 13 constant =CR
> 127 constant =DEL
>
> ...
> What sort of conventions do other people use for generic constants?
> I've consulted the naming convention from Leo Brodie.
Insofar as BL is the standard for hex 20, IMO the names without
any distinguishing symbol are best. However, CR is reserved for
a "newline" function (e.g. CR LF), whatever that may mean for a
particular output device.
I don't see any particular value in designating the defining word
used to produce something; its function is the important information,
not how it was defined.
Cheers,
Elizabeth
_Constant
Variables start with an uppercase letter and end with a tick:
Variable'
Graham Telfer
I agree. Often I start a program using constants, and later change them
to self fetching variables. Any special designations would have to
be updated to maintain consistancy.
<cr> <esc> might be good for charactors, or ARRAY.SIZE for the size of
a buffer, not because they are constants but because of what they represent.
jrh