Go的修订历史背后的故事是什么? [英] What's the story behind the revision history of Go?

查看:175
本文介绍了Go的修订历史背后的故事是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到前4个版本 f6182e5abf5e b66d0bf8da3e ac3363d7e788 172d32922e72 都来自Golang甚至提出之前的很长时间, 1972年以来最古老的。他们也都归功于AWK病房名气的Brian Kernighan。它们似乎在C中是 hello,world 实现。这是一个复活节蛋,还是有一些实际用途?

解决方案

线程 a>提及:




敬酒,复活节彩蛋,内部笑话,请选择:)。请注意相关提交的作者

表示线程引用 this commit 作为起点,同时也指出了,其中 Go规范的第一次修订版本

四个第一次提交的(声称)作者是 Brian Kernighan
Rob Pike 与Brian于1980年代在钟实验室,所以这可以被视为对他的专业出身的参考。



这个复活节彩蛋的想法是说明 Hello World C程序:



(请参阅最近的GopherCon 2014年4月发布的更多内容 hellogophers.slide - Rob Pike




Hello,World



  hg log -r 0:4 
changeset:0:f6182e5abf5e
user:Brian Kernighan< bwk>
date:Tue Jul 18 19:05:45 1972 -0500
汇总:hello,world

$ hg update -r 0
$ cat src / pkg / debug / macho / testdata / hello.b

main(){
extrn a,b,c;
putchar(a);的putchar(b)中;的putchar(C);的putchar( * N!);
}
a'hell';
b'o,w';
c'orld';






转换为C



  changeset:1:b66d0bf8da3e 
user:Brian Kernighan< bwk>
日期:Sun Jan 20 01:02:03 1974 -0400
汇总:转换为C

$ hg更新-r 1
$ cat src / pkg / debug / macho / testdata / hello.c
$ b $ main(){
printf(hello,world);






转换为草稿 - 建议ANSI C



  changeset:2:ac3363d7e788 
user:Brian Kernighan< research! BWK>
date:Fri Apr 01 02:02:04 1988 -0500
汇总:转换为草案 - 建议ANSI C

$ hg更新-r 2
$猫src / pkg / debug / macho / testdata / hello.c

#include< stdio.h>

main()
{
printf(hello,world\\\
);





$ h $最后一分钟修正:转换为ANSI C

  changeset:3:172d32922e72 
user:Brian Kernighan< bwk@research.att.com>
date:Fri Apr 01 02:03:04 1988 -0500
汇总:最后一分钟修正:转换为ANSI C

$ hg更新-r 3
cat src / pkg / debug / macho / testdata / hello.c


#include< stdio.h>

int
main(void)
{
printf(hello,world\\\
);
返回0;
}






/ h2>

  changeset:4:4e9a5b095532 
user:Robert Griesemer< gri@golang.org> ;
日期:Sun Mar 02 20:47:34 2008 -0800
总结:开始规范的起点。


I noticed that the first 4 revisions f6182e5abf5e, b66d0bf8da3e, ac3363d7e788, 172d32922e72 of the Go source are all from long before Golang was even proposed, the oldest being from 1972. They are also all credited to Brian Kernighan of AWK-ward fame. They seem to be hello, world implementations in C. Is this an easter-egg or is there some practical purpose?

解决方案

That thread mentions:

Homage, Easter egg, inside joke, take your pick :). Notice the authors of the commits in question too

Said thread references this commit as the starting point, but also points out to the actual first commit of the Golang project, with the first revision of the Go spec.

The (alleged) "author" of the four first commits is Brian Kernighan.
Rob Pike has worked with Brian in the 1980's, at Bell Labs, so this can be viewed as a reference to his professional origin.

The idea of this Easter egg is to illustrate an evolution of an Hello World program in C:

(See more with this recent GopherCon April 2014 talk hellogophers.slide - Rob Pike)


Hello, World

hg log -r 0:4
changeset:   0:f6182e5abf5e
user:        Brian Kernighan <bwk>
date:        Tue Jul 18 19:05:45 1972 -0500
summary:     hello, world

$ hg update -r 0
$ cat src/pkg/debug/macho/testdata/hello.b

main( ) {
    extrn a, b, c;
    putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';


Convert to C

changeset:   1:b66d0bf8da3e
user:        Brian Kernighan <bwk>
date:        Sun Jan 20 01:02:03 1974 -0400
summary:     convert to C

$ hg update -r 1
$ cat src/pkg/debug/macho/testdata/hello.c

main() {
    printf("hello, world");
}


Convert to Draft-Proposed ANSI C

changeset:   2:ac3363d7e788
user:        Brian Kernighan <research!bwk>
date:        Fri Apr 01 02:02:04 1988 -0500
summary:     convert to Draft-Proposed ANSI C

$ hg update -r 2
$ cat src/pkg/debug/macho/testdata/hello.c

#include <stdio.h>

main()
{
    printf("hello, world\n");
}


Last-minute fix: convert to ANSI C

changeset:   3:172d32922e72
user:        Brian Kernighan <bwk@research.att.com>
date:        Fri Apr 01 02:03:04 1988 -0500
summary:     last-minute fix: convert to ANSI C

$ hg update -r 3
cat src/pkg/debug/macho/testdata/hello.c


#include <stdio.h>

int
main(void)
{
    printf("hello, world\n");
    return 0;
}


Go spec starting point

changeset:   4:4e9a5b095532
user:        Robert Griesemer <gri@golang.org>
date:        Sun Mar 02 20:47:34 2008 -0800
summary:     Go spec starting point.

这篇关于Go的修订历史背后的故事是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆