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)

04.07.09

Quote of the day

Tags: , , , , — Jeff @ 13:17

It’s Independence Day, so what better topic to discuss than the juridical matters of the United States? (Frankly, there are more substantive topics to address, to be sure — as a palliative I direct your attention [yet again!] to the Federalist Papers for one such topic — but a dash of humor with underlying substance is never out of order.) Here follows a brief anecdote I ran across recently:

In Gilchrist v. O’Keefe, 260 F.3d 87 (2001), Sotomayor wrote for the panel, which rejected an inmate’s claim that he was unconstitutionally deprived of his right to counsel during his state sentencing proceeding when the trial judge declined to appoint a new attorney to replace the attorney who withdrew after the inmate punched him in the head.

See the original source, as well as the decision itself.

It is worth highlighting that the fact that the deprivation occurred during “state sentencing” is critical to the opinion, as 28 U.S.C. § 2254(d)(1) (the relevant clause in US code) prevents granting relief in response to a state proceeding, assuming the decision was not “contrary to clearly established Federal law” (which, the decision notes, it was not). As a consequence the decision need not (and does not) reach any question along the most obvious line suggested by the quote, at least not outside of dicta (with which, tangentially, I am not particularly inclined to disagree) — an example of how legal decisions need not be as obvious as they seem, and an example of how common sense may play little to no part in the legal reasoning of a “common-sense ruling”.

03.09.05

« Newer