Why does TeX Live's pdfTeX's %& parsing override the executable name?

In testing my answer to this question, I initially wrote the file

%& eplain
% code to answer question here
\bye


and compiled with pdftex e. Much to my surprise, the penultimate line of output was

Output written on e.dvi (1 page, 352 bytes).


If I change the first line to \input eplain or add the command line argument -output-format=pdf, then I get a pdf.

This same behavior can be observed by by starting a LaTeX file with %& latex and compiling with either pdflatex or pdftex so it's unrelated to eplain.

-
You are doing two different things. Using \input simply loads the relevant .tex file, whereas first-line parsing switches engine alias. Remember that almost all of the *tex execuatables are aliases for pdfTeX with the appropriate format. So the first line you are using effectively switch the command line to eplain. –  Joseph Wright Oct 15 '10 at 7:23
@Joseph Wright: I think your description is backward. The name of the executable is used as the name of the format. I didn't realize that there were different .fmt files for latex and pdflatex though. It doesn't really seem necessary to have them since one can choose the output format independently of the format file. –  TH. Oct 15 '10 at 12:43
Well, because that is what it is supposed to do. the %& line allows you to switch to another format than the one matching the executable name, so your line above is exactly as running eplain e or pdftex -fmt eplain e. Read the first few lines of pdftex --help.
I did read that, actually. The relevant line reads, "If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file, use it." What I wasn't aware of is that the .fmt file dictates the output format since, as I said to Joseph, they can be selected independently. –  TH. Oct 15 '10 at 12:46
@Khaled Hosny: In fact, just setting \pdfoutput=1 is sufficient to get pdf output. I had assumed (incorrectly) that that's essentially what pdftex would do by default I didn't expect the format files to be setting that at all. –  TH. Oct 15 '10 at 17:46