From: Jukka K. Korpela on
Under Subject: Re: How to change "margin-top" using JS
John G Harris wrote:

> On Fri, 30 Jul 2010 at 13:23:38, in comp.lang.javascript, Don wrote:
>> On Fri, 30 Jul 2010 21:16:42 +0100, Tim Streater
>
> <snip>
>>> By the way that's not a hyphen. It's a minus sign which is why JS is
>>> bleating.
>> I thought a "minus-sign" had the same character-code as a "hyphen".
>
> No. ASCII has a minus sign.

I have actually bought and read the ASCII standard (ANSI INCITS 4-1986), so
I know what I'm talking about. It has a character with the primary name
HYPHEN and the alternate name MINUS SIGN. In Unicode, this character is
called HYPHEN-MINUS to reflect its semantic ambiguity: it is used as a
hyphen, as a minus sign, as an en dash, as en em dash, and for other
purposes. Unicode additionally encodes, in different positions, the
unambiguous (or at least less ambiguous) characters HYPHEN and MINUS SIGN,
but in ASCII, you cannot make such a distinction.

Of course, in JavaScript and relatives, as in most programming languages,
the ASCII HYPHEN character has, by definition, the semantics of a minus sign
when used in an arithmetic expression. But this relates to the "higher level
protocol", the language definition, and not to character-level issues.

> A hyphen is longer and ASCII doesn't have one.

Wrong. ASCII has HYPHEN just as well as it has MINUS SIGN, or more (since
HYPHEN is the primary name). When a distinction is made between a hyphen and
a minus sign, the minus sign is surely longer. The length (width) of ASCII
HYPHEN varies by font, since its design may reflect the primary use as a
hyphen, where it should be fairly short by typographic tradition, or the
ambiguous semantics (so that the length is between the length of a
typographically suitable hyphen and the length of a typographically suitable
minus sign or en dash or em dash).

--
Yucca, http://www.cs.tut.fi/~jkorpela/