Sun Fortress language spec

Alexandre Bergel bergel at iam.unibe.ch
Wed Apr 27 12:34:33 UTC 2005


Hello,

Fortress is a new language from Sun. Thanks Marcus for having pointed out it. A spec is available on http://research.sun.com/projects/plrg/fortress0618.pdf
However, here is a short summary of the points for which I am interested in.

In Fortress there is no class. Just objects and traits. The language is statically typed, however it performs some inference if some type notation are missing. In Fortress, not everything is an object (e.g., top-level function can be defined). Function or methods can return multiple values, and not just one as in Smalltalk. Contracts (pre and post conditions) are also supported. The language has many other characteristics, but I will focus now more on traits.

I was curious to see what is the thing they call "trait".
In Fortress, a trait is a named group of methods (abstract or not). A object is defined by using a set of traits and declaring variables.

A trait that can inherit from other traits. Yes, multi-inheritance of traits. A trait is stateless.
In case of conflict (two methods or more having the same name are inherited), conflicting methods have to be compatible in order to satisfy multiple dispatch. It does not seem that a particular method can be excluded. A trait can exclude a trait.

If a trait T exclused a trait S, the two traits are mutually exclusive. No object can have them both, no third trait can extend them both, and neither may extend the other. I know that I am not so accurtate on trait exclusion, but the doc I found is no accurate more.

Something else (but I do not know in what it is useful for): if a trait definition T can include a 'bounds' clause, the trait must not be extended (i.e., inherited) with immediate subtraits other than those that appear in its 'bounds' clause. 

Traits can also be parameterized with some types. It seems that one can write some very complicated trait declarations with that.

Ok, so traits does not have field but just methods. Fields are declared when creating an object, and for each field, an accessor and a mutator are automatically defined.

Cheers,
Alexandre


On Wed, Apr 27, 2005 at 10:35:17AM +0200, Marcus Denker wrote:
> Hi,
> 
> A first language spec is out
> 
> http://research.sun.com/projects/plrg/fortress0618.pdf
> 
> (this is a research language with traits done at Sun ).
> 
>        Marcus

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.iam.unibe.ch/~bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



More information about the Squeak-dev mailing list