Sather Professor
   HOME

TheInfoList



OR:

Sather is an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of p ...
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
. It originated circa 1990 at the International Computer Science Institute (ICSI) at the
University of California, Berkeley The University of California, Berkeley (UC Berkeley, Berkeley, Cal, or California) is a public land-grant research university in Berkeley, California. Established in 1868 as the University of California, it is the state's first land-grant u ...
, developed by an international team led by
Steve Omohundro Stephen Malvern Omohundro (born 1959) is an American computer scientist whose areas of research include Hamiltonian physics, dynamical systems, programming languages, machine learning, machine vision, and the social implications of artificial int ...
. It supports
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
and generics by subtypes. Originally, it was based on
Eiffel Eiffel may refer to: Places * Eiffel Peak, a summit in Alberta, Canada * Champ de Mars – Tour Eiffel station, Paris, France; a transit station Structures * Eiffel Tower, in Paris, France, designed by Gustave Eiffel * Eiffel Bridge, Ungheni, M ...
, but it has diverged, and now includes several
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that ...
features. The name is inspired by Eiffel; the Sather Tower is a recognizable landmark at Berkeley, named after Jane Krom Sather, the widow of Peder Sather, who donated large sums to the foundation of the university. Sather also takes inspiration from other programming languages and paradigms:
iterator In computer programming, an iterator is an object that enables a programmer to traverse a container, particularly lists. Various types of iterators are often provided via a container's interface. Though the interface and semantics of a given iterat ...
s, design by contract,
abstract class In programming languages, an abstract type is a type in a nominative type system that cannot be instantiated directly; a type that is not abstract – which ''can'' be instantiated – is called a ''concrete type''. Every instance of an abstra ...
es,
multiple inheritance Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit features from more than one parent object or parent class. It is distinct from single inheritance, where an object or ...
, anonymous functions,
operator overloading In computer programming, operator overloading, sometimes termed ''operator ad hoc polymorphism'', is a specific case of polymorphism, where different operators have different implementations depending on their arguments. Operator overloading i ...
, contravariant type system. The original Berkeley implementation (last stable version 1.1 was released in 1995, no longer maintained) has been adopted by the
Free Software Foundation The Free Software Foundation (FSF) is a 501(c)(3) non-profit organization founded by Richard Stallman on October 4, 1985, to support the free software movement, with the organization's preference for software being distributed under copyleft (" ...
therefore becoming GNU Sather. Last stable GNU version (1.2.3) was released in July 2007 and the software is currently not maintained. There were several other variants: Sather-K from the
University of Karlsruhe The Karlsruhe Institute of Technology (KIT; german: Karlsruher Institut für Technologie) is a public research university in Karlsruhe, Germany. The institute is a national research center of the Helmholtz Association. KIT was created in 2009 w ...
; Sather-W from the
University of Waikato , mottoeng = For The People , established = 1964; years ago , endowment = (31 December 2021) , budget = NZD $263.6 million (31 December 2020) , chancellor = Sir Anand Satyanand, GNZM, QSO, KStJ , vice_chancellor = Neil Quigley , cit ...
(implementation of Sather version 1.3); Peter Naulls' port of ICSI Sather 1.1 to
RISC OS RISC OS is a computer operating system originally designed by Acorn Computers Ltd in Cambridge, England. First released in 1987, it was designed to run on the ARM chipset, which Acorn had designed concurrently for use in its new line of Archi ...
; and pSather, a parallel version of ICSI Sather addressing
non-uniform memory access Non-uniform memory access (NUMA) is a computer memory design used in multiprocessing, where the memory access time depends on the memory location relative to the processor. Under NUMA, a processor can access its own local memory faster than non ...
multiprocessor architectures but presenting a shared memory model to the programmer. The former ICSI Sather compiler (now GNU Sather) is implemented as a compiler to C, i.e., the compiler does not output
object Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an ...
or machine code, but takes Sather
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the w ...
and generates C source code as an
intermediate language An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A " ...
. Optimizing is left to the C compiler. The GNU Sather compiler, written in Sather itself, is dual licensed under the GNU
GPL The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the four freedoms to run, study, share, and modify the software. The license was the first copyleft for general u ...
& LGPL.


Hello World

class HELLO_WORLD is main is #OUT+"Hello World\n"; end; end; A few remarks: * Class names are ALL CAPS; this is not only a convention but it's enforced by the compiler. * The method called main is the entry point for execution. It may belong to any class, but if this is different from MAIN, it must be specified as a compiler option. * # is the constructor symbol: It calls the create method of the class whose name follows the operator. In this example, it's used for instantiating the OUT class, which is the class for the
standard output In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
. * The + operator has been overloaded by the class to append the string passed as argument to the stream. * Operators such as + are
syntactic sugar In computer science, syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use: things can be expressed more clearly, more concisely, or in an ...
for conventionally named method calls: a + b stands for a.plus(b). The usual arithmetic precedence conventions are used to resolve the calling order of methods in complex formulae.


Example of iterators

This program prints numbers from 1 to 10. class MAIN is main is loop i := 1.upto!(10); #OUT + i + "\n"; end; end; end; The loop ... end construct is the preferred means of defining loops, although while and repeat-until are also available. Within the construct, one or more iterators may be used. Iterator names always end with an exclamation mark. (This convention is enforced by the compiler.) upto! is a method of the INT class accepting one once argument, meaning its value won't change as the iterator yields. upto! could be implemented in the INT class with code similar to the following one. upto!(once m:INT):SAME is i: INT := self; -- initialise i to the value of self, -- that is the integer of which this method is called loop if i>m then quit; -- leave the loop when i goes beyond m end; yield i; -- else use i as return value and stay in the loop i := i + 1; -- and increment end; end; Type information for variables is denoted by the postfix syntax variable:CLASS. The type can often be inferred and thus the typing information is optional, as in anInteger::=1. SAME is a pseudo-class referring to the current class.


References

{{reflist


External links


Sather homepage
Class-based programming languages GNU Project software