开发者

C# language specification "Program Instantiation" appears to be mis-identified

In the C# language specification a Program is defined as

Program the input to the compiler.

While an Application is defined as

Application an assembly that has an开发者_开发技巧 entry point

But, they define

Program instantiation — the execution of an application.

Given the definition of "Program", shouldn't this be...

Application instantiation — the execution of an application.

instead?


As far as I can tell, this term doesn't occur in the Microsoft version of the specification. The annotated ECMA spec has this annotation after "Program":

Programs, assemblies, applications and class libraries
This definition of program differs from common usage. In C#, a program is just the input to the compiler. The output of the compiler is an assembly, which is either an application or a class library.

There aren't any other annotations nearby though. It does seem somewhat odd, which is perhaps why it doesn't appear in the MS spec.


No.

They're definitions, so they can be whatever they want. Your mistake is attempting to find a semantic link in the word program, where there is none. They are, as you've noted, unrelated.

What they're saying is "this is how we use this term"; there's basically nothing wrong with choosing any term, as long as the definitions are consistent. foo, bar, and baz would have been just as correct as program instantiation. As long as the names are internally consistent, and the definitions are correct, the names could be anything. They're just labels.

Someone at Microsoft obviously thought that it was more important that the term program instantiation be reflected in it's common usage. The term program probably didn't get the same treatment but, again, they're just names. And the names are "atomic": the word program is not at all related to the term program instantiation.


Since they're just labels, they terms can be replaced by anything. One possibility is:

X = the input to the compiler.

Y = an assembly that has an entry point

Z = the execution of Y.

Replacing any of the names with anything else makes no difference in their usage.

If I replace the above definition of Z with a new term XY:

XY = the execution of Y

this still holds. It's just a label, it gets semantic content from the definition, not from it's name. XY has no semantic relationship to X, and it's relationship to Y is only incidental.


When you read definitions of things, especially technical specifications, it's important to keep this in mind. There's often no best term for something, as there are often multiple common terms for the same thing, and they're not often defined rigourously enough to be meaningful in a precise specification.

There's an entire branch of philosophy dedicated to issues like this, and causing a "conflict" in the sense that you cite is pretty much unavoidable.

The writer's of the C# specification made their choice, and as long as it's internally consistent, it's "correct".


Based on given input, what the compiler outputs is still the program, only in the format of an assembly / application, such that it is:

Program, valid — a C# program constructed according to the syntax rules and diagnosable semantic rule.

I'll take a brave step here and say that we could remove ourselves from such specific context and look at an available definition of usage in English for Program:

  1. (6) A set of coded instructions that enables a machine, especially a computer, to perform a desired sequence of operations.
  2. (7) An instruction sequence in programmed instruction.

Both what is input to the compiler and that which is output can both be labelled by the above.

But actually, I'm going to have to vote to close as this is a question regarding the semantics of the English language.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜