https://news.ycombinator.com/item?id=8715971
The revision history of Go language begins with a number of interesting commits:
commit 18c5b488a3b2e218c0e0cf2a7d4820d9da93a554 Author: Robert GriesemerDate: Sun Mar 2 20:47:34 2008 -0800 Go spec starting point. SVN=111041 commit d82b11e4a46307f1f1415024f33263e819c222b8 Author: Brian Kernighan Date: Fri Apr 1 02:03:04 1988 -0500 last-minute fix: convert to ANSI C R=dmr DELTA=3 (2 added, 0 deleted, 1 changed) commit 0744ac969119db8a0ad3253951d375eb77cfce9e Author: Brian Kernighan Date: Fri Apr 1 02:02:04 1988 -0500 convert to Draft-Proposed ANSI C R=dmr DELTA=5 (2 added, 0 deleted, 3 changed) commit 0bb0b61d6a85b2a1a33dcbc418089656f2754d32 Author: Brian Kernighan Date: Sun Jan 20 01:02:03 1974 -0400 convert to C R=dmr DELTA=6 (0 added, 3 deleted, 3 changed) commit 7d7c6a97f815e9279d08cfaea7d5efb5e90695a8 Author: Brian Kernighan Date: Tue Jul 18 19:05:45 1972 -0500 hello, world R=ken
The very first commit consists of a single file named hello.b, which seems to be a "hello world" program in the B programming language. According to "Hello, World! program" article at Wikipedia, it was actually written by Kernighan for A Tutorial Introduction to the Language B in 1972, though I tend to doubt the commit date reflects the real date when the document had been written and/or published. (It'd be a much surprise if it was!)
The source code is as follows (no syntax highlighting is available for B as you might think):
main( ) { extrn a, b, c; putchar(a); putchar(b); putchar(c); putchar('!*n'); } a 'hell'; b 'o, w'; c 'orld';
The commit followed by the C version, which appeared in Kernighan's 1974 Programming in C: A Tutorial. "dmr" is the username of Dennis Ritche, the inventor of C.
main() { printf("hello, world"); }1988 is the year when C was standardized as part of ANSI and also when the second edition of K&R was published. The change in "convert to Draft-Proposed ANSI C" reflects the updates in the standard, that is, prototype declarations and standard headers.
#includeThe "last-minute" fix seems to have reflected the (presumed) addition in 2.1.2.2. Hosted Environment.main() { printf("hello, world"); }
A return from the initial call to the main function is equivalent to calling the exit function with the value returned by the main function as its argument. If the main function executes a return that specifies no value, the termination status returned to the host environment is undefined.The code is as follows:
#includeAnd those "reconstructed" changes are eventually followed by this, the initial language specification of Go language. Isn't it like seeing an epic?int main(void) { printf("hello, world\n"); return 0; }
0 件のコメント:
コメントを投稿