Fortress does the math
SAN FRANCISCO--Earlier today at JavaOne, held this week in San Francisco, Christine Flood of Sun Microsystems offered a preview of
Fortress, a programming language for writing math-heavy programs that will run in multicore and multiprocessor environments.
Funded in part by the Defense Department, Fortress has been positioned as Fortran killer. A lot of Fortran code still runs in government, especially for scientific duties, thanks to the fact that the ancient language has an ease with mathematical formulas that newer languages has yet to match.
If the preview is any indicator, Fortress will be very friendly to scientists. "We're going to do to Fortran what Java did C," Flood said.
Last month, the development team has shipped the first reference implementation of an interpreter for Fortress (available on the site). Flood admitted that it runs slow and doesn't reflect recent developments. The team hopes to have a working compiler by the end of the summer.
One of the strongest features of Fortress is that it allows users program directly in mathematical notation. For those scientists and other number-crunchers who think in terms of mathematics symbols, Fortress could simplify programming immeasurably.
As an example, Flood displayed a mathematical formula for the
NAS Conjugate Gradient benchmark. Even in small type, it took up almost half the presentation slide. Along side the formula was the Fortress code that carried out the formula. The two looked very, very similar.
The Fortress language incorporates a mathematical syntax, meaning that mathematic symbols are operators and can be used to write a program. As a result, mathematical operations look exactly the same in the code as they would as they do in the mathematical textbooks, or on the professors' whiteboards.
This is a big jump for programming languages. As a contrast, Flood displayed on the next slide the same formula as rendered in Fortran. It took up the entire slide
Of course, the immediate problem with using notation is that keyboards don't have mathematical symbols. There is no keys for, say set notation. This is a problem the development team is working on, Flood admitted. Right now, they have an ASCII-notation substitute for those characters.
"We don't know if they will ever be on the keyboard," she said. The team is thinking of working on an on screen editor with all the characters.
Fortress has a number of other strong mathematical features as well. For instance, units of measurements are types, assuring that no mistakes will be made multiplying, say, kilometers with miles. It allows for functional programming, allowing methods that recursively reference themselves.
Fortress also has generators and reducers. With generators, you can specify the range of an array, and it will fill in the numbers. Likewise, a reducer can reduce all the numbers in an array, perhaps by summation.
***
While strong in mathematical notation, Flood positioned Fortress in her talk as a general usage language, though one still very early in development. She mentioned that it borrows the best ideas from a lot of other languages and takes on problems earlier languages did not address.
Flood mentioned a whole mess of design improvements. One is contracts. Borrowed from the Eiffel program language, contracts assures a function will not execute unless all the needed inputs are ready, and in the proper form. This is a good technique for cutting down on bugs and strengthening security. Another improvement is multiple inheritance, in which a class can inherit trait from multiple parent classes.
Perhaps the most prophetic feature, though, is that Fortress is a language for writing programs that run in parallel. Few of the languages today anticipated multicore processors, which require
different programming techniques in order to be fully utilized.
Fortress features both implicit and explicitly parallelism, Flood said. Unlike every other programming language, Fortress assumes that the functions you write can run in parallel. A programmer has to specify when this is not the case. It will also divvy out work among multiple processors.
Posted by Joab Jackson on May 06, 2008 at 9:39 AM