The Go Language (PART-1)


gif


All programming languages reflect the programming philosophy of their creators, which often includes a significant component of reaction to the perceived shortcomings of earlier languages. The Go project was born of frustration with several software systems at Google that were suffering from an explosion of complexity. (This problem is by no means unique to Google.)


Go is sometimes described as a "C-like language", or as "C for the 21st century".

From C, Go inherited its -

  • Expression syntax,

  • Control-flow statements,

  • Basic data types,

  • Call-by-value parameter passing,

  • Pointers,

  • C’s emphasis on programs that compile to efficient machine code and cooperate naturally with the abstractions of current operating systems.


The Go project includes the language itself, its tools and standard libraries, and last but not least, a cultural agenda of radical simplicity. As a recent high-level language, Go has the benefit of hindsight, and the basics are done well: it has -

  • Garbage collection,

  • A package system,

  • First-class functions,

  • Lexical scope,

  • A system call interface,

  • Immutable strings in which text is generally encoded in UTF-8.


But it has comparatively few features and is unlikely to add more. For instance, it has -

  • No implicit numeric conversions,

  • No constructors or destructors,

  • No operator overloading,

  • No default parameter values,

  • No inheritance,

  • No generics,

  • No exceptions,

  • No macros,

  • No function annotations,

  • No thread-local storage.


The language is mature and stable, and guarantees backward compatibility: older Go programs can be compiled and run with newer versions of compilers and standard libraries.


Go has enough of a type system to avoid most of the careless mistakes that plague programmers in dynamic languages, but it has a simpler type system than comparable typed languages. This approach can sometimes lead to isolated pockets of “untyped” programming within a broader framework of types, and Go programmers do not go to the lengths that C++ or Haskell programmers do to express safety properties as type-based proofs. But in practice Go gives programmers much of the safety and run-time performance benefits of a relatively strong type system without the burden of a complex one.


Go encourages an awareness of contemporary computer system design, particularly the importance of locality. Its built-in data types and most library data structures are crafted to work naturally without explicit initialization or implicit constructors, so relatively few memory allocations and memory writes are hidden in the code. Go’s aggregate types (structs and arrays) hold their elements directly, requiring less storage and fewer allocations and pointer indirections than languages that use indirect fields. And since the modern computer is a parallel machine, Go has concurrency features based on CSP (Communicating Sequential Processes). The variable-size stacks of Go's lightweight threads or goroutines are initially small enough that creating one goroutine is cheap and creating a million is practical.


Go's standard library, often described as coming with "batteries included", provides clean building blocks and APIs for I/O, text processing, graphics, cryptography, networking, and distributed applications, with support for many standard file formats and protocols.



NOTE: Go natively handles Unicode, so it can process text in all the world's languages.

24 views0 comments

Recent Posts

See All