A participant in a DNS course asked Carsten Strotmann of Men & Mice why the comment character in a DNS zone master file is a semicolon; Carsten shrugged his shoulders and asked me. In my often snarky way, I replied authoritatively "because it was programmed to do so" and shrugged it off.
; this is a comment www 3600 IN A 192.168.1.1 ; the (duh!) Web server
Never before have I questioned why a particular form of comment is used in a language. Neither the
* in column 7 for COBOL (I started off with punch cards), nor the
REM (or the expanded
:) in BASIC. (I've long forgotten what Nixdorf 8860 (not 8086) assembler used.) The
/* */ in C didn't bother me, nor did the
// when it appeared. Perl's and Python's
#, and Lua's
-- didn't hurt me either, and MS-DOS
INI files used a ... (drumroll) ... semicolon (
However, as a trainer (which I am not in this particular case) I always try to respond to a question, so I felt obliged to at least attempt to find the reason. Whilst I went off in search of the first version of the BIND name server I could find, I asked people who could know:
Stéphane Bortzmeyer recommended I ask somebody called @svnr2000 (wow!) which I did and added in Paul Vixie as the original and long-time maintainer/author of BIND for good measure.
Responses started pouring in with all sorts of good ideas. David Ulevitch of OpenDNS fame said
old-school languages used to use
;over hash, like assembly, and Vixie found it pleasing.
which sounded rather sane to me in addition to which it was corroborated by
c'est assez classique non? Le
'est utilisé en Lisp et dans la plupart des assembleurs
Also the fact that the semicolon is used in hosts.txt is sensible.
These answers didn't really satisfy me though, so I kept on digging. Meanwhile I had the code of BIND version 4.8 dated 1988 and was glancing through the source of
db_load.c, where I quickly found the relevant spot, but I was disappointed that there was no comment as to why the semicolon. Be that as it may, I should have looked at the comments at the top of the file, and Tony Finch nailed it: it says
/* * Load data base from ascii backupfile. Format similar to RFC 883. */
RFC 833, by Paul Mockapetris, is dated November 1983, and specifies
Semicolon is used to start a comment; the remainder of the line is ignored.
That same Mr. Paul Mockapetris who, quoting WikiPedia,
is an American computer scientist and Internet pioneer, who, together with Jon Postel, invented the Internet Domain Name System (DNS).
In other words, he must know, right? Well, I was thrilled to actually have Paul Mockapetris respond to my query a few hours later:
According to a reply by Paul Vixie, the semicolon was chosen as a comment in zone files because that's what the PDP-10 and other macro assemblers used in those days, and Christoph points me to GAS which lists single-line comments for assemblers.
So, is there anything else you want me to ask? ;-)