28.02.10

ECMA-262 quote of the day

If comparefn is not undefined and is not a consistent comparison function for the elements of this array (see below), the behaviour of sort is implementation-defined.

[…]

A function comparefn is a consistent comparison function for a set of values S if all of the requirements below are met for all values a, b, and c (possibly the same value) in the set S: The notation a <CF b means comparefn(a,b) < 0; a =CF b means comparefn(a,b) = 0 (of either sign); and a >CF b means comparefn(a,b) > 0.

  • Calling comparefn(a,b) always returns the same value v when given a specific pair of values a and b as its two arguments. Furthermore, Type(v) is Number, and v is not NaN. Note that this implies that exactly one of a <CF b, a =CF b, and a >CF b will be true for a given pair of a and b.
  • Calling comparefn(a,b) does not modify the this object.
  • a =CF a (reflexivity)
  • If a =CF b, then b =CF a (symmetry)
  • If a =CF b and b =CF c, then a =CF c (transitivity of =CF)
  • If a <CF b and b <CF c, then a <CF c (transitivity of <CF)
  • If a >CF b and b >CF c, then a >CF c (transitivity of >CF)
ECMA-262 3rd edition or ECMA-262 5th edition, 15.4.4.11 Array.prototype.sort (comparefn)

26.02.10

Working on the JS engine, Episode III: offered without comment

#define WORKAROUND(cx_, saver_)                                               \
    Workaround WORKAROUND_PASTE(w_, __LINE__)((cx_), (saver_))
#define WORKAROUND_PASTE(a_, b_) WORKAROUND_PASTE2(a_, b_)
#define WORKAROUND_PASTE2(a_, b_) a_ ## b_ /* having fun yet? */
#define SAVER(cx_, saver_)                                                    \
    AutoValueRooter saver_(cx_);                                              \
    WORKAROUND((cx_), (saver_));

25.02.10

Correcting a few misconceptions

(I speak on behalf of Adam Smith and free market economic ideas alone in this post.)

In a recent blog post, Gen Kanai, in discussing the EU browser ballot, at one point opines that South Korea’s monopoly browser market is a consequence of a free market. (I derive this from the first sentence of his second paragraph, in which I interpret, “To those critics of the browser ballot [supporting a free market through the invisible hand], I would present to you the example of South Korea”, as saying South Korea’s situation is a negative consequence of the invisible hand. It seems to me that either this interpretation is correct, or presenting the example would be a non sequitur.) Specifically, by his words he deems South Korea’s situation a consequence of “Adam Smith’s invisible hand” (link in original). This doesn’t seem to me to be the case, and I would like to correct a few mistaken assumptions implicit behind his assertion.

Did Adam Smith’s invisible hand approve of monopolies?

Through specific invocation of Adam Smith it is implied that, in his support of a free market, his acceptance of laissez-faire economics also means he would have condoned monopolies. This is not the case. Adam Smith was certainly no fan of monopolies, and his magnum opus, The Wealth of Nations, repeatedly noted the bad outcomes engendered by monopoly.

Europe, however, has hitherto derived much less advantage from its commerce with the East Indies than from that with America. The Portuguese monopolized the East India trade to themselves for about a century, and it was only indirectly and through them that the other nations of Europe could either send out or receive any goods from that country.

Smith goes on in subsequent sentences to explain that the exclusion of other countries, and the widespread use of nationally-chartered companies such as the East India Company to only permit exclusive access to the East Indies, made trade with America of greater overall importance than trade with East India — this notwithstanding the greater sophistication of potential trading partners in the East Indies, capable of supplying more value than “savages and barbarians” of the New World. This is hardly acceptance of monopoly. One might also consider this later statement impugning monopolies:

Country gentlemen and farmers are, to their great honour, of all people, the least subject to the wretched spirit of monopoly.

True, Smith permitted the possibility of monopoly in the case of two narrow exceptions: with respect to industries where a national defense interest might come into play (see Book IV, Chapter 2), and with respect to an industry resulting from “a dangerous and expensive experiment” such as autonomous colonization and fortification (see Book V, Chapter 1). These exceptions, however, certainly do not swallow the rule. It is simply inaccurate to say that Adam Smith’s support of a free market implies support of monopolies. (In any case, while Adam Smith’s The Wealth of Nations may have been a seminal work of free-market theory, it is not its highest point, its ne plus ultra, but merely its starting point.)

(With respect to the particular situation of South Korea and encryption, it’s plausible a national security interest was an initial factor in the development and use of a proprietary algorithm. Such an interest seems highly ephemeral given the development of widely used standards a short time later, however, so Smith’s acceptance of this particular monopoly on that basis would have been fleeting at best.)

Is the browser market in South Korea the consequence of a free market?

I freely admit that I am mostly uninformed on this topic; my knowledge comes primarily from Gen Kanai’s first post on the cost of monoculture in South Korea’s browser market. If I have misconstrued the narrative given in that post, I welcome correction.

Quoting from that post:

The history goes back to 1998, when the 128 bit SSL protocol was still not finalized (it was finalized by the IETF as RFC 2246 in Jan. ‘99.) South Korean legislation did not allow 40 bit encryption for online transactions (and Bill Clinton did not allow for the export of 128 bit encryption until December 1999) and the demand for 128 bit encryption was so great that the South Korean government funded (via the Korean Information Security Agency) a block cipher called SEED. SEED is, of course, used nowhere else except South Korea, because every other nation waited for the 128 bit SSL protocol to be finalized (and exported from the US) and have standardized on that.

In the early years of SEED, users downloaded the SEED plugin to their IE or Netscape browsers, either an Active X control or a NSplugin, which was then tied to a certificate issued by a Korean government certificate authority. Can you see where this is going?) When Netscape lost the browser war, the NSplugin fell out of use and for years, S. Korean users have only had an Active X control with the SEED cipher to do their online banking or commerce or government.

Gen Kanai, the cost of monoculture (with KISA link updated)

SEED, then, was the direct result of government funding of encryption and protocol research. The two (later one) SEED plugins used to implement client-side support for the protocol and encryption were part of a package provided exclusively by the government, as Gen Kanai says in a comment on that post:

Each Korean citizen is issued a nation ID number. This is embedded into the certificate issued by the Korean CA. Thus non-Koreans in Korea (such as US military in Korea) cannot make secure transactions like online banking or online commerce. The ‘package’ (including SEED, the national ID, and the Active-X cert.) that the CA’s distribute is Active-X based, and thus only works in Windows and IE.

Assuming the above is true, I’m not sure how the free market was responsible for the establishment of Microsoft’s monopoly on being able to provide browsers supporting South Korean encryption. The South Korean government brought about the single-protocol monopoly there through its funding of SEED and its ubiquitous use in governmental settings. It alone provided the packages implementing SEED in browsers. The result may be a Microsoft monopoly (if one partially due to a global decline in Netscape market share), but it seems one sanctioned by the Korean government. As Gen Kanai later notes,

Korea will only get beyond this problem by 1) applying Korean laws on open standards to the certificate authorities, 2) reassigning new certificates which work with open web standards to all Koreans, 3) reprogramming all Korean websites to support 128 bit SSL which will allow for a heterogeneous marketplace of operating systems and web browsers.

The third component of the solution requires actions by private entities, but the first and second components require governmental action. Indeed, they are direct steps to overcome previous governmental missteps, and the third component arguably doesn’t make sense except in anticipation of the first two occurring imminently. In what way did the invisible hand, or free markets, bring about South Korea’s encryption monoculture and monopoly? True, Netscape’s declining market share turned a duopoly into a monopoly — but the Korean government chose not to offer plugins for other browsers after that point (and indeed had not offered any for Internet Explorer on Windows Vista, either). Did the problem truly lie with the free market, or did it lie with the Korean government? Whose action brought about the monopoly? Whose inaction sustains it? Whose action is necessary to move toward proper competition?

It also seems worth noting that, later in Gen Kanai’s recent post, he mentions that until recently South Korea required Korean-specific hardware in smartphones. Further, South Korean government guidelines and regulations still require SEED encryption and signing for financial transactions, perpetuating SEED’s monopoly in phone browsers. These governmental restrictions on the cell phone market simply further show how governmental interference in South Korea has impacted Koreans for the worse.

A return to Adam Smith

That the Korean monopoly is the result of government action is particularly important when considering what views Adam Smith might have had of it. While Smith disdained monopolies, he particularly disdained government-created monopolies such as the East India monopolies noted previously. He writes:

The legislature…ought…to be particularly careful neither to establish any new monopolies…nor to extend further those which are already established.

It seems clear that Adam Smith would have been doubly suspicious of government-created monopolies of the sort present in South Korea, precisely because they are government-created.

A brief note on choice and browsers

None of this is to say that choice, or browser choice in particular, is bad — it’s good, precisely for reasons demonstrated by South Korea! However, South Korea’s experience doesn’t really seem to demonstrate a free market-induced shortcoming which might add support for a non-free-market action like a browser ballot. Neither the legitimacy nor the illegitimacy of a browser ballot is increased by reference to the history of encryption protocols and browsers in South Korea, even if South Korea emphatically demonstrates the ills of monopolies.

08.02.10

Brief talk on ES5 and Mozilla support for it

Tags: , , , , , , — Jeff @ 12:32

I gave a three-minute not-actually-lightning-talk-but-let’s-call-it-that-anyway on ECMA-262 5th edition, what’s in it, and the state of Mozilla’s support for it at the Mozilla weekly meeting this week. It’s probably old hat if you’ve been following the standard closely, but if you haven’t it gives a short and sweet overview of what’s new; there’s a three-minute video of the actual talk on the meeting page (start at around 7:00 into the complete video). If you’re strapped for time, view the slides and turn off stylesheets (View > Page Style > No Style in Firefox) to see notes on what roughly accompanied each slide.