Justin du Coeur (jducoeur) wrote,
Justin du Coeur

Another Language to Love

My latest "read one paragraph during each complilation cycle" discovery is Fortress, the most interesting toy to come down the pike in a while.

Fortress is apparently what Guy Steele has been doing over at Sun for the past couple of years. I gather that his group was given the mandate to throw away all assumptions, not worry about back-compatibility or anything like that, and focus in on writing a new language intended for serious high-performance applications. The result (so far -- this is still a work in progress) is intriguing.

(The name, BTW, originally stood for "secure Fortran", to reflect the focus on scientific apps. The end result has little to do with Fortran aside from that intent, though. This is really the successor language to Fortran in important ways.)

Fortress takes the threading problem seriously, and builds it into the language. They break with common assumptions in some language features -- for example, evaluation of both tuples and for loops are parallel by default, not ordered. I'm still digging into the threading side of the equation, but I'm very curious to see how they deal with synchronization (which is really the hard part about threaded code).

They're clearly deeply focused on using this for mathematical and simulation oriented applications, because *math* is central here. The language is "rendered" in Unicode, and the constructs are designed so that a program typically comes out *looking* like math. You can use greek letters freely. The language has first-order concepts like "SUM", and they are rendered in the usual math-textbook way. Things like comprehensions are available out of the box. Variables are allowed to have not just types but units, and it understands the way that units relate to each other.

The language is object-oriented, but not quite as overtly so as some. Everything is an object, but it is entirely legal to have class-less singleton objects -- indeed, they use these (rather than things that are class-like) for most of their examples. They apparently don't quite have classes or interfaces in the usual sense, instead using things called "traits" that are somewhere between the two. It has a lot of modern concepts like type inference and contracts, and is explicitly multiple-inheritance (yay!), but I'm not yet clear whether it has things like closures.

The syntax is its own, but shows a clear Pascal heritage. Not necessarily the choice I'd have made, but they are already using curly braces in so many ways in here that they probably didn't want to surrender them to be used for blocks. It's explicitly designed to be highly extensible -- they claim that the core language is actually quite small, and most of what you see in the reference manual is built on top of that.

I'm still reading into it (and will be for a while -- the reference manual is 400 pages, showing that this really is a Guy Steele project), but it's fascinating stuff. I'm not sure that I'd want to use it for the Internet-oriented work I'm doing now (certainly I'd need to think long and hard about whether it supplied enough benefit to be worth the mental realignments), but it looks *really* lovely for game programming: if they can get the compiler to be good enough, the math orientation and focus on multiprocessor/multicore programming makes oodles of sense for the game world...

ETA: And may I just say that I am very amused at a language that is explicitly designed to encourage to have lots of slack in your programming. ("Slack" is their term for the ratio between amount of work to do and number of threads available. The more slack you have, the more efficiently you can use your processor. Slack is good -- program for slack!)
Tags: languages, programming
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded