Go (programming language)

From Seo Wiki - Search Engine Optimization and Programming Languages
Jump to navigationJump to search
Go
File:Golang.png
Paradigm compiled, concurrent, imperative, structured
Appeared in 2009
Designed by Robert Griesemer, Rob Pike, and Ken Thompson
Developer Google
Major implementations gc (8g, 6g), gccgo
Influenced by C, Oberon, Limbo[1]
OS Linux, Mac OS X, others[2]
License BSD
Website http://golang.org/

Go is a compiled, garbage-collected, concurrent programming language developed by Google.[3]

The initial design of Go was started in September 2007 by Robert Griesemer, Rob Pike, and Ken Thompson,[1] building on previous work related to the Inferno operating system.[4] Go was officially announced in November 2009, with implementations released for the Linux and Mac OS X platforms.[5] As of the launch, Go was not considered to be ready for adoption in production environments.[6]

Description

The syntax of Go is close to that of C except for the type declarations; other syntactical differences are the missing parentheses around for and if expressions. It is designed for exceptionally fast compilation times, even on modest hardware.[7] The language requires garbage collection. Certain concurrency-related structural conventions of Go (channels and alternative channel inputs) are borrowed from Tony Hoare's CSP, but many (such as Edsger Dijkstra's guarded commands) are omitted. Unlike previous concurrent programming languages such as occam or Limbo, Go does not provide any in-built notion of safe or verifiable concurrency [1]. Go also has some features of the Pi calculus such as channel passing.

Features not included in Go are exception handling, type inheritance, generic programming, assertions, and method overloading and pointer arithmetic.[1] Of these, the Go authors express an openness to generic programming and exceptions, explicitly argue against assertions, while defending the choice to omit type inheritance on efficiency grounds.[1] Unlike Java, maps (also known as hashes or dictionaries) are an intrinsic part of the language, as are strings.

Visibility of functions outside of their defining file is defined implicitly according to the capitalization of their identifier, in contrast to C, where an explicit static keyword is used.

Implementations

There are currently two Go compilers. 6g (and its supporting tools, collectively known as gc) are in C, using yacc/Bison for the parser. Gccgo is a Go compiler with a C++ front-end with a recursive descent parser coupled to the standard GCC backend.[8] Both compilers only work on Unix-like systems, although a Windows version available for non-production use is located here; it is maintained by a developer named Hector Chu[9] separate from the go lang team.[10]

Examples

The following is a Hello world program in Go.

package main

import "fmt"

func main() {
	fmt.Printf("Hello, World\n")
}

Example illustrating how to write a program like the Unix echo command in Go:[11]

package main

import (
	"os"
	"flag" // command line option parser
)

var omitNewline = flag.Bool("n", false, "don't print final newline")

const (
	Space   = " "
	Newline = "\n"
)

func main() {
	flag.Parse() // Scans the arg list and sets up flags
	var s string = ""
	for i := 0; i < flag.NArg(); i++ {
		if i > 0 {
			s += Space
		}
		s += flag.Arg(i)
	}
	if !*omitNewline {
		s += Newline
	}
	os.Stdout.WriteString(s)
}

Reception

Go's initial release led to much discussion.

Michele Simionato wrote in an article for artima.com "Here I just wanted to point out the design choices about interfaces and inheritance. Such ideas are not new and it is a shame that no popular language has followed such particular route in the design space. I hope Go will become popular; if not, I hope such ideas will finally enter in a popular language, we are already 10 or 20 years too late :-("[12]

Mark C. Chu-Carroll writes "So... At the end of the day, what do I think? I like Go, but I don't love it. If it had generics, it would definitely be my favorite of the C/C++/C#/Java family. It's got a very elegant simplicity to it which I really like. The interface type system is wonderful. The overall structure of programs and modules is excellent. But it's got some ugliness. Some of the ugliness is fixable, and some of it isn't. On balance, I think it's a really good language, but it could have been a lot better. It's not going to wipe C++ off the face of the earth. But I think it will establish itself as a solid alternative. And hopefully, over time, they'll fix some of the worst parts of the ugliness, without sacrificing the beauty or simplicity of the language."[13]

Dave Astels at Engine Yard writes "Go is extremely easy to dive into. There are a minimal number of fundamental language concepts and the syntax is clean and designed to be clear and unambiguous. Go is still experimental and still a little rough around the edges."[14]

Blogger Michael Hoisie writes "Overall I think go will find a good niche - a high performance language that's suitable for most system tasks. It has a great initial library, and it seems to have attracted a large community already(the irc chat room currently has over 500 users)."[15]

A blog posting in InformationWeek considers the creation of a new language to be unjustified given that many other languages already existed: "I don't have anything against a programming language devised experimentally (...) but what's the experiment?".[16] He expresses the belief that the major problem facing developers is the difficulty of writing code that runs on platforms like browsers which are not compatible with each other.

Ars Technica interviewed Rob Pike, one of the authors of Go, and asked why a new language was needed. He replied that "it wasn't enough to just add features to existing programming languages, because sometimes you can get more in the long run by taking things away. They wanted to start from scratch and rethink everything." They did not want however "to deviate too much from what developers already knew because they wanted to avoid alienating Go's target audience."[6]

Naming dispute

On the day of the general release of the language, Francis McCabe, developer of the Go! programming language, requested a name change of Google's language to prevent confusion with his language. While McCabe has not trademarked the name, commenters on McCabe's posting have called for Google to adopt a new one.[17] As of 16 December 2009 (2009 -12-16), Google has not commented on the issue, although they let InformationWeek know that they were aware of it.

Concurrency

Go provides goroutines, small lightweight threads; the name alludes to coroutines. Goroutines are created with the "go" statement from anonymous or normal functions.

Goroutines are executed in parallel with other goroutines, including their caller. They do not necessarily run in separate threads, but a group of goroutines are multiplexed multiple threads - execution control is moved between them by blocking them when sending or receiving messages over channels.

References

This article incorporates material from the official Go tutorial, which is licensed under the Creative Commons Attribution 3.0 license.
  1. 1.0 1.1 1.2 1.3 1.4 "Language Design FAQ". golang.org. 2010-01-16. http://golang.org/doc/go_lang_faq.html. Retrieved 2010-01-18. 
  2. "Go Porting Efforts". Go Language Resources. cat-v. 2010-01-12. http://go-lang.cat-v.org/os-ports. Retrieved 2010-01-18. 
  3. Kincaid, Jason (2009-11-10). "Google’s Go: A New Programming Language That’s Python Meets C++". TechCrunch. http://www.techcrunch.com/2009/11/10/google-go-language/. Retrieved 2010-01-18. 
  4. "Source file src/cmd/goyacc/goyacc.go". golang.org. http://golang.org/src/cmd/goyacc/goyacc.go. Retrieved 2010-01-18. "Derived from Inferno's utils/iyacc/yacc.c
    http://code.google.com/p/inferno-os/source/browse/utils/iyacc/yacc.c"
     
  5. "Installing Go". golang.org. 2010-01-14. http://golang.org/doc/install.html#tmp_33. Retrieved 2010-01-18. 
  6. 6.0 6.1 Paul, Ryan (2009-11-10). "Go: new open source programming language from Google". Ars Technica. http://arstechnica.com/open-source/news/2009/11/go-new-open-source-programming-language-from-google.ars. Retrieved 2009-11-13. 
  7. Rob Pike. (2009-11-10) (flv). The Go Programming Language. [Tech talk]. Google. Event occurs at 8:53. http://www.youtube.com/watch?v=rKnDgT73v8s#t=8m53. 
  8. "FAQ: Implementation". golang.org. 2010-01-16. http://golang.org/doc/go_faq.html#Implementation. Retrieved 2010-01-18. 
  9. "Download initial Windows port of go here". golang-nuts. Google. 2009-11-23. http://groups.google.com/group/golang-nuts/browse_thread/thread/b42b70700575d7bb. Retrieved 2010-01-18. 
  10. "Issue 107: Windows support for Go". Go issue tracker. http://code.google.com/p/go/issues/detail?id=107. Retrieved 2010-01-18. 
  11. "A Tutorial for the Go Programming Language". golang.org. 2010-01-16. http://golang.org/doc/go_tutorial.html. Retrieved 2010-01-18. 
  12. Simionato, Michele (2009-11-15). "Interfaces vs Inheritance (or, watch out for Go!)". artima. http://www.artima.com/weblogs/viewpost.jsp?thread=274019. Retrieved 2009-11-15. 
  13. Chu-Carroll, Mark (2009-11-11). "Google's New Language: Go". Scienceblogs. http://scienceblogs.com/goodmath/2009/11/googles_new_language_go.php. Retrieved 2009-11-11. 
  14. Astels, Dave (2009-11-9). "Ready, Set, Go!". engineyard. http://www.engineyard.com/blog/2009/ready-set-go/;. Retrieved 2009-11-9. 
  15. Hoisie, Michael (2009-11-11). "My thoughts on the Go Programming language". hoisie dot com. http://www.hoisie.com/post/my_thoughts_on_the_go_programming_language. Retrieved 2009-11-11. 
  16. Yegulalp, Serdar (2009-11-12). "Why Google's Go Might Be A No-Go". InformationWeek. http://www.informationweek.com/blog/main/archives/2009/11/why_googles_go.html;jsessionid=D3SOS0VJYRLBTQE1GHPCKHWATMY32JVN. Retrieved 2009-11-13. 
  17. Claburn, Thomas (2009-11-11). "Google 'Go' Name Brings Accusations Of 'Evil'". InformationWeek. http://www.informationweek.com/news/software/web_services/showArticle.jhtml?articleID=221601351. Retrieved 2010-01-18. 

External links

ar:غو (لغة برمجة) da:Go (programmeringssprog) de:Go (Programmiersprache) es:Go (lenguaje de programación) fr:Go (langage) it:Go (Linguaggio di programmazione) he:GO (שפת תכנות) hu:Go (programozási nyelv) ms:Go (bahasa pengaturcaraan) nl:Go (google) ja:Go (プログラミング言語) no:Go (programmeringsspråk) pl:Go (język programowania) pt:Go (linguagem de programação) ru:Go (язык программирования) sr:Гоу fi:Go (ohjelmointikieli) tr:Go (programlama dili) vi:Ngôn ngữ GO zh:Go

If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...