Sather

Sather

Infobox programming language
name = Sather
logo =
paradigm = object-oriented, functional
year = 1990
designer = Steve Omohundro
developer = Free Software Foundation, University of Karlsruhe, University of Waikato
latest release version =
latest release date =
typing = static, strong
implementations = GNU Sather, Sather-K, Sather-W
dialects =
influenced_by = Eiffel
influenced = Cool

Sather is an object-oriented programming language. It originated circa 1990 at the International Computer Science Institute at the University of California, Berkeley, developed by an international team led by Steve Omohundro. It supports garbage collection and generics by subtypes.

Originally, it was based on Eiffel, but it has diverged, and now includes several functional programming features. It is probably best to view it as an object-oriented language, with many ideas borrowed from Eiffel. Even the name is inspired by Eiffel; the Sather Tower is a recognizable landmark at Berkeley. Sather also takes inspiration from other programming languages and paradigms: iterators, design by contract, abstract classes, multiple inheritance, anonymous functions, operator overloading, contravariant type system. Some of these features are normally only found in functional programming languages.

The original Berkeley implementation is now maintained by many people, not all at Berkeley, and has been adopted by the Free Software Foundation therefore becoming GNU Sather. There are at least two other implementations: Sather-K from the University of Karlsruhe, and Sather-W from the University of Waikato.

The former ICSI sather compiler (now GNU Sather) is implemented as a compiler to C, i.e., the compiler does not output object or machine code, but takes Sather source code and generates C source code as an intermediate language. Optimizing is by the C compiler, Sather code often performs better than the corresponding C++ code, and the generated C code can always be optimized by hand.

The GNU Sather compiler, written in Sather itself, is dual licensed under the GNU GPL & LGPL.

Hello World

class HELLO_WORLD is main is #OUT+"Hello World "; end; end;

A few remarks:
* Class names are ALL CAPS; this is not only a convention but is 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, calling method create of the corresponding class; here it is used for instantiating the OUT class, which is actually stdout.
* The + operator has been overloaded here to stand for stream append.
* Operators such as + are syntactic sugar 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.
* The program layout allows for pre- and post-conditions (not shown here), showing Sather's Eiffel lineage.

Example of iterators

class MAIN is main is loop i := 1.upto!(10); #OUT + i + " "; end; end; end;

This program prints numbers from 1 to 10.

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 integer class INT accepting one once argument, meaning its value will not change as the iterator yields. upto! could be implemented in the INT class like this:

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 a postfix syntax variable:CLASS. The type can often be inferred and thus the typing information is optional, like in anInteger::=1. SAME is a convenience pseudo-class referring to the current class.

External links

* [http://www.icsi.berkeley.edu/~sather/ Sather homepage]

* [http://www.gnu.org/software/sather/ Gnu Sather]


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Sather — Einflüsse: Eiffel Sather ist eine objektorientierte Programmiersprache. Sie entstand 1990 am International Computer Science Institute (ICSI) der University of California in Berkeley (USA). Pate war primär Eiffel, aber auch C, C++, Cecil, CLOS,… …   Deutsch Wikipedia

  • Sather — est un langage de programmation orienté objet. Il est né aux alentours de 1990 à l’International Computer Science Institute à l Université de Berkeley, développé par une équipe internationale menée par Steve Omohundro. Il supporte le ramasse… …   Wikipédia en Français

  • Sather Gate — Das Sather Gate, ein bekanntes Symbol der Universität von Kalifornien in Berkeley im Süden des Campus gelegen, separiert die Sproul Plaza von der Brücke über den Strawberry Creek, welche zum Zentralbereich des Campus führt. Das Tor, dessen… …   Deutsch Wikipedia

  • Sather Tower — Der Sather Tower, in Anlehnung an sein venezianisches Vorbild (Markusturm) auch Campanile genannt, ist mit 93,6 Metern Höhe der größte Glockenturm außerhalb Italiens. Er ist das Wahrzeichen der Universität von Kalifornien in Berkeley. Die… …   Deutsch Wikipedia

  • Sather Air Base — or Camp Sather is a United States Air Force base on the west side of Baghdad International Airport. There are about 1,200 Air Force airmen serving at the base as part of the 447th Air Expeditionary Group. The main function of the base is to serve …   Wikipedia

  • Sather Gate and Bridge — Sather Gate Die Sather Gate and Bridge, ein bekanntes Symbol der Universität von Kalifornien in Berkeley im Süden des Campus gelegen, separiert die Sproul Plaza von der Brücke über den Strawberry Creek, welche zum Zentralbereich des Campus führt …   Deutsch Wikipedia

  • Sather (Begriffsklärung) — Sather steht für: die Programmiersprache Sather die Altertumsprofessur an der University of California at Berkeley, siehe Sather Professor Sather ist der Familienname folgender Personen: Glen Sather (* 1943), kanadischer Eishockeyspieler, trainer …   Deutsch Wikipedia

  • Sather Gate — is a prominent landmark separating Sproul Plaza from the bridge over Strawberry Creek, leading to the center of the University of California, Berkeley campus. The gate was donated by Jane K. Sather, a benefactor of the university, in memory of… …   Wikipedia

  • Sather Professor — Wheeler Hall, wo der Sather Professor traditionell vorträgt Sather Professor ist der Titel einer festen Gastprofessur für Altertumswissenschaft an der University of California at Berkeley. Sie wurde 1912 auf das Betreiben des… …   Deutsch Wikipedia

  • Sather Tower — Infobox nrhp | name =Sather Tower nrhp type = caption = Sather Tower, from California Memorial Stadium, at sunset location= Berkeley, California lat degrees = 37 | lat minutes = 52 | lat seconds = 19 | lat direction = N long degrees = 122 | long… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”