Sather Gate And Bridge
   HOME

TheInfoList



OR:

Sather is an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impleme ...
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
. 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 university, public Land-grant university, land-grant research university in Berkeley, California, United States. Founded in 1868 and named after t ...
, 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 recyclable ...
and generics by
subtypes In programming language theory, subtyping (also called subtype polymorphism or inclusion polymorphism) is a form of type polymorphism. A ''subtype'' is a datatype that is related to another datatype (the ''supertype'') by some notion of substit ...
. Originally, it was based on
Eiffel Eiffel may refer to: Places * Eiffel Tower, in Paris, France, designed by Gustave Eiffel *:* Champ de Mars – Tour Eiffel station, Metro station serving the Eiffel Tower * Eiffel Bridge, Ungheni, Moldova, designed by Gustave Eiffel * Eiffel Bri ...
, but it has diverged, and now includes several
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by Function application, applying and Function composition (computer science), composing Function (computer science), functions. It is a declarat ...
features. The name is inspired by Eiffel; the
Sather Tower Sather Tower is a bell tower with clocks on its four faces on the campus of the University of California, Berkeley. It is more commonly known as The Campanile ( , also ) for its resemblance to the Campanile di San Marco in Venice. It is a recog ...
is a recognizable landmark at Berkeley, named after Jane Krom Sather, the widow of
Peder Sather Peder Sather (September 25, 1810 – December 28, 1886) was a Norwegian-born American banker who is best known for his legacy to the University of California, Berkeley. His widow, Jane K. Sather, donated money in his memory for two of the sc ...
, 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 progressively provides access to each item of a collection, in order. A collection may provide multiple iterators via its interface that provide items in different orders, such as forwards ...
s,
design by contract Design by contract (DbC), also known as contract programming, programming by contract and design-by-contract programming, is an approach for designing software. It prescribes that software designers should define formal, precise and verifiable ...
,
abstract class In object-oriented programming, a class defines the shared aspects of objects created from the class. The capabilities of a class differ between programming languages, but generally the shared aspects consist of state ( variables) and behavior ( ...
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 ...
,
anonymous function In computer programming, an anonymous function (function literal, expression or block) is a function definition that is not bound to an identifier. Anonymous functions are often arguments being passed to higher-order functions or used for const ...
s,
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 ...
, 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. The organisation supports the free software movement, with the organization's preference for software being distributed ...
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; ) is both a German public university, public research university in Karlsruhe, Baden-Württemberg, and a research center of the Helmholtz Association. KIT was created in 2009 when the University of Ka ...
; Sather-W from the
University of Waikato The University of Waikato (), established in 1964, is a Public university, public research university located in Hamilton, New Zealand, Hamilton, New Zealand. An additional campus is located in Tauranga. The university performs research in nume ...
(implementation of Sather version 1.3); Peter Naulls' port of ICSI Sather 1.1 to
RISC OS RISC OS () is an operating system designed to run on ARM architecture, ARM computers. Originally designed in 1987 by Acorn Computers of England, it was made for use in its new line of ARM-based Acorn Archimedes, Archimedes personal computers an ...
; and pSather, a parallel version of ICSI Sather addressing
non-uniform memory access Non-uniform memory access (NUMA) is a computer storage, 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 ...
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 a ...
or
machine A machine is a physical system that uses power to apply forces and control movement to perform an action. The term is commonly applied to artificial devices, such as those employing engines or motors, but also to natural biological macromol ...
code, but takes Sather
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
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 "good" ...
. Optimizing is left to the C compiler. The GNU Sather compiler, written in Sather itself, is
dual licensed Multi-licensing is the practice of distributing software under two or more different sets of terms and conditions. This may mean multiple different software licenses or sets of licenses. Prefixes may be used to indicate the number of licenses ...
under the GNU
GPL The GNU General Public Licenses (GNU GPL or simply GPL) are a series of widely used free software licenses, or ''copyleft'' licenses, that guarantee end users the freedom to run, study, share, or modify the software. The GPL was the first c ...
&
LGPL The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
.


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 Standard may refer to: Symbols * Colours, standards and guidons, kinds of military signs * Standard (emblem), a type of a large symbol or emblem used for identification Norms, conventions or requirements * Standard (metrology), an object t ...
. * 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


External links

{{cite web , title=Sather Home Page , url=http://www.icsi.berkeley.edu/~sather/ , archive-url=https://web.archive.org/web/20240325214242/https://www1.icsi.berkeley.edu/~sather/ , archive-date=2024-03-25 , access-date=2025-01-16 Class-based programming languages GNU Project software