Thread overview
The Fan Programming Language
Jun 12, 2008
Paul D. Anderson
Jun 12, 2008
BCS
Jun 12, 2008
Paul D. Anderson
Jun 12, 2008
bearophile
Jun 12, 2008
BLS
June 12, 2008
From a blog highlighted on java.net --

http://www.jroller.com/scolebourne/entry/the_fan_language_is_it

The blog entry speculates Fan might be a ("the") next-generation Java, i.e., not an extension of Java but a new language that avoids Java's shortcomings. Whether it succeeds is in the eye of the beholder.

There are some interesting similarities with the D programming language. In particular there is a D-like immutability concept. In Fan there is only one keyword ("const") with multiple meanings -- const variables, const classes and const functions... And there is only one kind of immutability -- const objects can never change. No mention is made of transitivity. I don't know whether it is ignored or implicit.

Anyhoo, might be worth looking at.

Paul

June 12, 2008
Reply to Paul,

> From a blog highlighted on java.net --
> 
> http://www.jroller.com/scolebourne/entry/the_fan_language_is_it
> 
> The blog entry speculates Fan might be a ("the") next-generation Java,
> i.e., not an extension of Java but a new language that avoids Java's
> shortcomings. Whether it succeeds is in the eye of the beholder.
> 
> There are some interesting similarities with the D programming
> language. In particular there is a D-like immutability concept. In Fan
> there is only one keyword ("const") with multiple meanings -- const
> variables, const classes and const functions... And there is only one
> kind of immutability -- const objects can never change. No mention is
> made of transitivity. I don't know whether it is ignored or implicit.
> 
> Anyhoo, might be worth looking at.
> 
> Paul
> 

"Fan runs on the JVM and the .NET runtime. It manages this by writing to a temporary intermediate format, which then gets further compiled to the right bytecode."


Source -> Fan-IL -> JVM/MSIL -> bin -> micro-ops -> ...

How far removed from the actual cpu can you get!

(Note: I'm not saying this is a problem...)


June 12, 2008
BCS Wrote:

> Reply to Paul,
> 
> > there is only one keyword ("const") with multiple meanings -- const variables, const classes and const functions... And there is only one kind of immutability -- const objects can never change. No mention is made of transitivity. I don't know whether it is ignored or implicit.
> 
> "Fan runs on the JVM and the .NET runtime. It manages this by writing to a temporary intermediate format, which then gets further compiled to the right bytecode."
> 
> 
> Source -> Fan-IL -> JVM/MSIL -> bin -> micro-ops -> ...
> 
> How far removed from the actual cpu can you get!
> 
> (Note: I'm not saying this is a problem...)
> 
> 

Yes, it is emphatically not a down-to-the-hardware language.

Also, upon further review, there is a second sort of "const". Any class member may have the "readonly" attribute. This attribute means that the setter is private. No guarantee of immutablity is implied.
June 12, 2008
Paul D. Anderson:
> From a blog highlighted on java.net -- http://www.jroller.com/scolebourne/entry/the_fan_language_is_it

There are lot of new languages coming up now, but they are quite similar, because most of them run on just two virtual machines, sharing the same problems, garbage collector, etc.

I have seen the following in another language (I don't remember what one, maybe Scala, and I think it's an interesting thing. Boo language too allows something similar), I think this may be useful for D too:

>Dynamic coding
Fan encourages more dynamic coding styles. If you use the dot to call a method (as per normal Java) then the method is compile time checked. If you use the arrow operator, then the method is called by reflection. Further, if the method called by reflection doesn't exist, then this error can be caught (the 'trap' method) which is like the 'method missing' concepts in other languages and enables powerful DSLs to be written.
  obj.doStuff()   // compile-time checked call, as per Java
  obj->doStuff()   // runtime reflection call

This can also be thought of as enabling duck typing.<


Regarding the "each" method and the like, I think it may be useful, but Python list/gen comps are simpler and nicer looking, while C# linq is more powerful:

>
list.each |Str val, Int index| {
  echo("$index = $val")
 }
<


Regarding semicolons:
>Lines do not need a semicolon at the end. A newline will suffice.

Groovy and Scala too don't require them, you can see some groovy examples here:
http://shootout.alioth.debian.org/gp4/groovy.php
For example:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=nbody&lang=groovy&id=0
You can see that semicolons are an useless form of redundancy.

Bye,
bearophile
June 12, 2008
Paul D. Anderson schrieb:
> From a blog highlighted on java.net --
> 
> http://www.jroller.com/scolebourne/entry/the_fan_language_is_it

What I really like is the code blocks (closure) syntax.
smalltalk like code-blocks are much cleaner than our D closure stuff.
(especially when used to build iterators)

Bjoern