D
Dr J R Stockton
Sun said:What does StrC mean? I was guessing would mean "convert to a signed
numerical string."
The /Str./ identifies it as a member of the set. The "C" can be taken
to mean Common, Core, or Code. It was not intended to be used directly,
only by StrU and StrS. StrU is Unsigned, StrS is Signed, and you can
think of T & W as meaning Thickness & Width, or just as nearby letters.
The variable names are also unclear to me.
M & N are given in comment. St is fairly obviously a String. B was
going to be a Boolean, but it turned out to be a Number either 0 or 1;
one can use false or true instead.
Also, as a convention, variables are camel case, as are function names
(unless the function is intended to be used as a constructor).
I write code according to habits developed in using Algol, SIR, FORTRAN,
Pascal, Delphi, Macro-11, and possibly some I've forgotten, since time
immemorial. It's too late to change them now, but users can alter their
copies as they like.
The FAQ mostly follows that convention. The code could be more explicit
with more descriptive variable and function names, such as
'prependString', 'toUnsignedString', 'toFixedString'.
What do you think?
Bloat. These are short routines, so it should be easy to see what the
variables are used for. I like compact code, so that I can see more at
once; and long names, especially in a case-dependent language with
implicit declaration, are too susceptible to mis-spellings.
It's the algorithm which is important, not the presentation.
While you're there : today I wrote
Date.prototype.toSt = new Function(" /* Omit parenthetical */\n" +
" return this.toString().replace(/( \\(.+\\))$/, '')")
ISTR that there are nicer-looking ways of doing that, apart from using a
lexically-separate function? In particular, I'd like the actual source
to look more like Date.prototype.toSt.toString(), without double
escapes. It removes the wasteful and incorrect bit of FireFox and
Chrome output.
Your newsreader seems to remove blank lines, alas.
It appears that you are a Mac user - I've never seen my site in Mac, and
can only hope it looks much the same as on a PC.