Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

Sometimes I read a sentence containing the word canonical, but I cannot find appropriate meaning of the word.

For example, in this link:

Returns a canonical representation for the string object.

It's hard for me to find an appropriate definition from Google Dictionary:

ca·non·i·cal Adjective /kəˈnänikəl/

  1. According to or ordered by canon law
    • the canonical rites of the Roman Church
  2. Included in the list of sacred books officially accepted as genuine
    • the canonical Gospels of the New Testament
  3. Accepted as being accurate and authoritative
    • the canonical method of comparative linguistics
  4. (of an artist or work) Belonging to the literary or artistic canon
    • canonical writers like Jane Austen
  5. According to recognized rules or scientific laws
    • canonical nucleotide sequences
  6. Of or relating to a general rule or standard formula
  7. Of or relating to a cathedral chapter or a member of it
share|improve this question
This is really a programming question, and to be honest even the programmers aren't sure what their current jargon means. But here is the issue as asked on StackOverflow. I'm going to vote to close this one as not relevant to normal English as we understand it at ELU. –  FumbleFingers Jul 20 '11 at 4:05
@FumbleFingers, this is definitively not a programming question. It is a question about a specific context, however I feel that OP has an interest to learn about the word itself and how it came to be used in specific context (in specific jargon). I would vote not to close if there was a button for that. –  Unreason Jul 20 '11 at 9:55
@Unreason: Well I think OP's usage is highly specific to programming. Stacker, for example, has pretty much defined the meaning - pretty much OP's defn:6, except in this case there's no special reason to assume conformance to any particular standard - so long as all references are canonical in respect of the same standard, that's all that matters. But it's fully covered by Answers in the StackOverflow link I gave, and I don't see what ELU is likely to add to that. –  FumbleFingers Jul 20 '11 at 15:03
@FumbleFingers, EL&U can explain connection to standard English; a lot of people learn English through specific, expert language and jargon so they know what a word means in their field, but can not connect it general language. The link you provided explains only the specific meaning and does not tie back to the usage in general sense. –  Unreason Jul 20 '11 at 15:08
@Unreason: "a lot of people learn English through specific, expert language and jargon" +1 That is exactly what I want to say. –  Xiè Jìléi Jul 28 '11 at 3:42

5 Answers 5

up vote 10 down vote accepted

In computing, the "canonical" form of something usually means something like "a standardised base form, to which any given variant resolves which you apply any relevant conversions". For example, you could have various paths "$NEILSDIR$\Directory", "$USERPATH$\Neil\Directory", but the canonical form of these might be "C:\Users\Neil\Directory".

Another type of conversion that the word commonly applies to is character encoding.

Unfortunately, I don't think the general dictionary entry you quote gives you so much of a clue in this case as to the technical use.

share|improve this answer

When this word is used by programmers, it is a synonym for "authoritative," "standard," or "official." That's meaning number 3 in the definition you quote.

It implies that there is one best, most official, most standard way to represent the string object and this is it.

For example sometimes things can be represented using a relative link or an absolute link. Relative might be something like ../foo.txt meaning "The file foo.txt in the folder above this one" while absolute is something like \\www.example.com\fileserver\share\foo.txt which can only refer to one file on the Internet. One might say that the latter name is canonical.

share|improve this answer
On the side of precision I'd like to point out that canonical is not necessary the best way; it is only canonical: standardized and widely known/used/understood. (It might be the best, but it is not a defining characteristic; for example absolute path is not the best form for a path, but it is best to use it in scripts due to several reasons that became canon) –  Unreason Jul 20 '11 at 11:00
When I (as a programmer) use it, I don't mean either "authoritative" or "official": I mean "in the most standard form", which usually has a precise definition. –  Colin Fine Jul 20 '11 at 13:50
Good point; I will revise my answer. –  Joel Spolsky Jul 20 '11 at 13:55

Of the dictionary meanings given, three of them are very similar:

3. Accepted as being accurate and authoritative
5. According to recognized rules or scientific laws
6. Of or relating to a general rule or standard formula

The first two of these imply reference to an authority or recognized rule, which is usually not the case for a programming usage like canonical representation. The last (definition 6) is the most appropriate: according to a general rule.

For example, strings might be considered equivalent whether in upper case or lower case. For a particular program, the designer might have a rule that all strings are to be stored in upper case. That means that upper case is the canonical representation.

share|improve this answer

This is an interesting word within and out of programming context. A nice mix of explanations from both perspectives can be found in good old jargon file - see canonical.

The usual or standard state or manner of something. This word has a somewhat more technical meaning in mathematics. Two formulas such as 9 + x and x + 9 are said to be equivalent because they mean the same thing, but the second one is in canonical form because it is written in the usual way, with the highest power of x first. Usually there are fixed rules you can use to decide whether something is in canonical form. The jargon meaning, a relaxation of the technical meaning, acquired its present loading in computer-science culture largely through its prominence in Alonzo Church's work in computation theory and mathematical logic (see Knights of the Lambda Calculus). Compare vanilla.

share|improve this answer

From http://www.webopedia.com/TERM/C/canonical.html

(adj.) Authoritative or standard; conforming to an accepted rule or procedure. When referring to programming, canonical means conforming to well-established patterns or rules. The term is typically used to describe whether or not a programming interface follows the already established standard.

In Java string literals are stored in the source code depending on your encoding e.g. Latin-1, internaly UTF-8 is used. The canonical representation means that Unicode "\u000a" (6 bytes) will be transformed to the UTF-8 representation of a linefeed (1 byte).

I'm not sure whether canonical could be applied to variable expansion, for directories I would give another example: C:\users\admin\..\neil would be normalized to C:\users\neil

share|improve this answer
For the benefit of those who don't know, "..\" in a directory path means parent of the directory parsed to so far. So "admin\..\" just pointlessly goes down to "admin\" and back up again, meaning that bit can be removed without making any difference. Like you, I'd call that normalisation rather than canonicalisation. (Yeah yeah, I know you'd have z's in both, but you know what I mean! :) –  FumbleFingers Jul 20 '11 at 15:10
...in short, canonicalisation is just an unnecessary techie jargon alternative to standardisation. –  FumbleFingers Jul 20 '11 at 15:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.