Are the C programming language and its object-oriented offspring – C++, C#, Objective-C – still well-suited to the requirements of multithreaded, network-oriented computing environments today? That’s the question on the minds of engineers at Microsoft Research, whose latest programming language is today being officially moved off the back burner. The F# language has received the company’s official blessing.
Am I the only one finding it amusing that they qualified a language derived from OCaml as being “experimental”?
I mean, by OCaml’s standards, object-orientation under a C-derived language could be called “experimental”. But I digress
Edit: a little clarification on what I meant in the first sentence
Edited 2007-10-23 21:19
I guess that would depend on why they call it experimental.
Not emphasized in the article, but functional languages are an excellent vehicle for writing multi-core, multi-thread, or SMP code. Functional languages don’t have nearly as many variables, so there’s less to synchronize.
Which makes Apple’s use of ObjC as a superset of C fantastic for leveraging all of C combined with ObjC’s object messaging model we all know with the ever expanding collection of frameworks under the Cocoa moniker.
But the article makes me ask two questions right away:
1) How suited would this be to OS programming? It seems like programming in F# would me much closer to machine language and the ‘on-silicon’ processes than most normal programming languages, C included.
2) Is this in any way related to the “C# variant” that Microsoft Research has used for programming Singularity?
It also reminds me, just a little bit, of when I programmed MUF (Multiuser Forth). God, I hated that language… ^^;
It’s a .Net language so you’re really not close to machine language…
I know it’s .NET, but I meant in structure; functional languages are closer to how many chips work, if I understand functional languages right.
(Then again, there are apparently some chips that can run MSIL directly, which further complicates the issue.)
>functional languages are closer to how many chips work, if I understand functional languages right.
Well, I’d say that your understanding is wrong: many chips are stateful: they contain registers, memory..
And even pure combinatorial circuits are not really ‘functional’: their state depends on the time..
functional languages are closer to how many chips work, if I understand functional languages right.
Well, then you certainly understand it wrong.
The difference is more or less how programs are organized. And I personally break languages into the following categories:
1. Chaos – e.g. assembly, binary, etc. where you are not required to have any real structure.
2. Procedural/Functional/Structured – organized by the processing of functions and data structures
3. Object Oriented – organized by processing objects through their inherent interfaces (methods).
You could probably break Procedural/Functional/Structured into two if you really wanted to – Functional/Procedural and Structured, where the difference is between being centered around functions and being centered around data structures. (Whether you use “Functional” or “Procedural” is dependent upon the language family you use – e.g. C family or ALGOL/Modula family.)
Functional and procedural are completely different. Procedural programs depend heavily on mutable state. Functional program may have no mutable state at all.
Functional and procedural are completely different. Procedural programs depend heavily on mutable state. Functional program may have no mutable state at all.
I guess you could make that argument too. It’s still procedure (function) driven though. So it’s kind of a half-state between Functional and Structured from that perspective.
It seems like programming in F# would me much closer to machine language and the ‘on-silicon’ processes than most normal programming languages, C included.
On the contrary #F is right farther away as high level language.
There is more information on F# at Ars Technica [ http://arstechnica.com/news.ars/post/20071023-microsoft-to-push-fun… }
What an absolutely fantastic way to reproduce Haskell, and give us something truly new and innovative.
I’ll have to dig out my old university notes on paradigms and functional languages. Thankfully, one lecturer at university actually wanted to teach and educate us about something different and potentially very useful, and expand our minds. Did Standard ML there too, but this guy liked Haskell. It’s a sad indictment of computing as a profession today that most people won’t know what a functional language is.
But, if it brings functional programming to wider audience then I won’t complain. There are many useful applications of functional languages.
Edited 2007-10-23 21:29
F# isn’t a reproduced Haskell, it’s a reproduces OCaml. It began as a .NET’ized OCaml, and has been developed from that point on.
I’ve been playing with F# for over a year, even buying the “Foundations of F#” book (though the upcoming “Expert F#” book might be considered the more “official” F# book, as one of its authors is F# lead Don Syme (both are available at amazon.com). Very cool language.
Here’s a couple relevant links:
http://research.microsoft.com/fsharp/fsharp.aspx
http://blogs.msdn.com/dsyme/default.aspx
http://www.fsharp.net/
http://fsharpnews.blogspot.com/
http://cs.hubfs.net/blogs/default.aspx
Microsoft has been using it internally (XBox Live makes use of it) and others have been using it, but it’s remained a “research” language within Microsoft Research, so there hasn’t been “official” support for it. I’m glad to see it being productized. I’ve read the various Microsoft blogs on this, and unfortunately F# won’t be included in VS 2008 since that’s too close to shipping (though, apparently there was some thought of doing just that). It hasn’t been decided yet how the productized version of F# will be released.
You mentioned Standard ML, well at the time that F# was started (based on OCaml), SML.NET was also started (based on SML). But its development stagnated, and isn’t anywhere near the maturity of F#.
As for Haskell, maybe Microsoft will prodcutize that someday. Microsoft Research somehow gained maintenance control of the Glaskow Haskell Compiler a few years ago, and Haskell guru Simon Peyton Jones works at MSR now.
Bad name. Everybody will say, sooner or later, what the F# is that!?
My first thought was: Great, next we’ll see the F#@$ extended specification…
MS should patent this new discovery before anyone else attempts to copy their ‘functional’ language.
“the foundations for an interactive data visualization environment like MATLAB,”
This sounds nice.
F# = Microsoft Only
OCaml = x-platform
All (well most) languages have their place.
You mentioned OCaml’s advantage over F#.
F#’s advantage over OCaml is that F# code can seamlessly operate with that of any .NET language, as well as access the .NET Framework libraries (e.g. BCL, WinForms, WPF, DirectX, LINQ), and non-Framework .NET libraries such as XNA and the numerous 3rd-party .NET libs. One could also program SilverLight 1.1 applets with F# (and SilverLight is x-platform (Windows and Mac, Linux (via Moonlight); IE, Safari, and Firefox), so SilverLight F# code is x-platform as well).
F#’s other advantage is that once it’s productized, it’ll have major financial backing from a large, high-profile, non-niche company. Including F# in a future Visual Studio or a A “Visual F# Express”, for example, could be huge.
Edited 2007-10-24 00:32
Not very sure about becoming a professional product.
It belongs to the Research section, at least for now, so it only has some acceptance from Microsoft, specially from the economical backup point of view.
Look at IronPython, yes, is fine and nice and etc, and backed up by Microsoft, but where is the industrial support or follow up?
IIRC, some scripting in Vista is done in IronPython.
This “industry” you’re talking about runs C# and VB.NET. They don’t know Python. With IronPython Microsoft tried to cater to the comp sci fresh-out-of-college people. IOW, it was a way to leverage the experience those college students had with scripting projects, while attracting them to the MS Mothership.
My impression is that IronPython is surrounded by a *load* of hype, if only for the fact that it meant Microsoft endorsing the poster child of Open Source programming languages, but IMO it’s just a novelty. Then again, I’m biased towards Ruby (actually, anything that leans towards Lisp (or Prolog) and Smalltalk is bound to attract me), so I’m not the most trustworthy source of Python critique. Take my words with grains of 50/50 NaCl/KCl.
Edit: on a second thought, F# is probably targeting the academia as well. When I had AI classes, for instance, the computer was running Windows, but every time my professor had show us and run a piece of Prolog code, he’d SSH his Linux box upstairs and run it on GNU Prolog. I can easily imagine MS trying to recover some mindshare from the AI/functional programming academic community. Shared Source, IronPython, sponsoring teaching .NET and XNA in Games Design and Programming classes, and now F#… That sounds like a plan to me.
Edited 2007-10-24 01:06
Silverlight 1.1 has the ability not only to run compiled .NET code (produced by any .NET language), but also run textual source code of IronPython, IronRuby, JScript, and VBx. There’s your IronPython “support and followup”.
That said, IronPython isn’t “productized” like C# and VB are. F# will be productized like C# and VB, so it’ll get support akin to those languages rather than the Iron languages, I’m guessing (hoping).
Wrong, or missleading, at least.
IronPython, or IronRuby should have their own support and traceability. Mono, or Silverlight can be able to process IronPython code, just because of the produced intermediated code, but IronPython is not the target there!
Is the same as implying than JRuby or Jython are successfull because any JVM can execute them.
Besides, which is the current real support for Mono?
“Wrong, or missleading, at least.
IronPython, or IronRuby should have their own support and traceability. Mono, or Silverlight can be able to process IronPython code, just because of the produced intermediated code, but IronPython is not the target there!
Is the same as implying than JRuby or Jython are successfull because any JVM can execute them.”
——————————————————
Silverlight 1.1 (and Moonlight 1.1) can run “produced intermediated code” for any .NET language, including IronPyton, but is able to run textual code for IronPython, IronRuby, JScript, and VBx.
See:
http://www.voidspace.org.uk/ironpython/silverlight/index.shtml
http://www.voidspace.org.uk/ironpython/silverlight/introduction.sht…
http://www.voidspace.org.uk/ironpython/silverlight/silverlight_appl…
If you’re still not convinced, watch this presentation by IronPyton lead Jim Hugunin and IronRuby lead Jon Lam:
http://sessions.visitmix.com/default.asp?event=1011&session=2012&pi…
(I don’t know if Silverlight compiles IronPython text code on the fly before running it, but the point is that Silverlight has special support for IronPython (and IronRuby, VBx, JScript, XAML), such that a website’s silverlight applet can consist of .py files (among other files).)
Also, according to the above links:
“Visual Studio 2005 (as a language integration example)
Visual Studio 2008 (expression evaluator and WPF designer examples)
ASP.NET
The XNA game design framework
Microsoft Robotics Kit
Project Jasper (a declarative database project specifically fro VB and IronPython)”
So Microsoft is indeed using IronPython. It’s not just a showpiece as you and someone else seem to be saying.
“Besides, which is the current real support for Mono?”
IronPython runs on Mono, as is well known. I’m not sure what point your trying to make here. Are you asking Microsoft to provide official customer support for Mono? That won’t happen. But they do provide official Moonlight support for the devs that are implementing Moonlight (and Moonlight 1.1 runs on Mono).
Edited 2007-10-24 05:52
I think both of those could be easily replaced with “language of choice = cross-platform.”
The language is not the implementation.
F# runs on Mono. Check your facts.
I guess this helps keeping up with the taks to learn a new language every year. Studying a similar language will always be easier than trying a radically different concept!
More seriously, it is really great to see a new language, or an evolution of an existing one. No language is perfect, or the continuous evolution of computing renders existing languages less suitable.
C#, MS or not, made a better Java, learning of the mistakes of the Sun language; even small things as requiring specific syntax to define overriden methods helps catching potential problems, which is definitely an improvement. And this happen with (most) new (or evolved) languages.
I am a Python programmer (in heart, I make a living out of C++), and it is obvious to me than deep changes will be required to keep up with multicore programming… or creating a new language for that purpose, hopefully with the simplicity of Python.
Now, whether functional programming is the path to follow, I keep my doubts. I enjoy a lot writting Lisp code, and learning functional programmming probably made a better overall programmer out of me, but I definitely favour traditional declarative languages (did I say I make a living out of C++?)
What really calls my attention is this possibility to build up programs with a good mix of declarative programming (say C#) and functional programming. And scripting, do not forget IronPython!
In any case, this is somehow also achievable on Java. As far as I know, it exists an Ocaml-Java project, and the Scala language is considered functional as well.
Good times, anyway, at least if you enjoy languages for the sake of it.
What the hell does:
Are the C programming language and its object-oriented offspring – C++, C#, Objective-C – still well-suited to the requirements of multithreaded, network-oriented computing environments today? That’s the question on the minds of engineers at Microsoft Research, whose latest programming language is today being officially moved off the back burner. The F# language has received the company’s official blessing.
have to do with the article?
It’s a circle jerk for their own future language technolgy, F#.
Flying frogs and all that.
http://www.ffconsultancy.com/
But pretty cool page if you want to get hooked on F#, Ocaml, etc.
I’ve just installed it, and can’t compile the Life example.
It requires some MailboxProcessor class, but I could not find any info for it on the net.
Is there some reason why these languages are being names after musical notes?. As a guitar player, all I see are notes.
E F F# G G# A A# B C C# D D#. Coincidence maybe seeing as there are no +’s. Just a thought.
Good questions considering sharps on the piano are the least used and flats are more commonly used.
What would be really funny is E#, or B#
You seem to be interested in music. My operating system doesn’t support standard music files types, but it plays songs if you enter notation. One voice, though. Here’s a nice song.
“e”=eighth note
“et”=eighthnote triplet
“q”=quarter note
void EndTsk()
{
Sound(0);
Exit;
}
void Song()
{
Fs->end_task_cb=&EndTsk;
music_tempo=2.5;
while (TRUE) {
Play(“eDEqFqFetEEFqDeCDeDEetCGF”);
Play(“eDEqFqFetEEFqDeCDeDEetCGF”);
Play(“eDCqDqEeAAetEEFetEDGetBDCqF”);
Play(“eDCqDqEeAAetEEFetEDGetBDCqF”);
}
}
Song;
I can do this in Ruby (assuming there were similar classes) by doing the following, which looks much cleaner and is less verbose (am I missing something about this F# language) …
menu_open = MenuItem.new( “&Open…”, Shortcut.CtrlO ) do
d = OpenFileDialog.new() do | d |
d.initial_directory = “c:\”
d.filter = “txt files (*.txt)|*.txt|All files (*.*)|*.*”
d.filter_index = 2
d.restore_directory = true
if d.show_dialog() = DialogResult.OK
d.open_file() do | file |
puts “The first line of the file is: %s!
” % file.readline ()
end
end
You’re missing the point. It’s not about syntax…you can do everything you outlined in any language. The point is that F# is a purely functional language…I’d highly recommend reading up on what makes a functional language…well, functional.
If anyone is interested, here’s an interview with a guy who wrote a book on F#:
http://www.hanselminutes.com/default.aspx?showID=94
I just got started with C#/.NET, so I don’t even pretend to understand most of it, but thought somebody might find it useful
http://www.fortran.com/F/
.. the experimental ‘disfunctional’ languages originating in Redmond…
F# is an interesting language, but the article writer has no clue at all about functional programming.
First of all, he makes it sound as if functional programming is “a step back in language evolution”. This is of course not the case. OCaml makes C based OO look like a toy.
Then he gives an ugly, unindented block of code as an example. How is anybody supposed to see the beauty of functional languages when looking at this code.
And then he mentions multithreading but gets sidetracked to some boring webservices application. The real advantage of functional languages wrt. multithreading is that you can actually use a quad or 8 core machine without having to resort to low level threading primitives like locking.
That is a _huge_ advantage.
About another functional programming language, a revised summary of ECMAScript 4 is available since yesterday :
http://www.ecmascript.org/es4/spec/overview.pdf
(Well, Javascript is a FL disguised with C syntax 🙂
(sorry for bad English)
F# is not pure functional, right? just as Objective CAML is not. It does support mutable state, it has “for” loops, you can modify a string in place (which you can’t even do in Python.) The folks who would write C as if it were FORTRAN, can write F# as if it were C. It’s really not in the same league with Haskell.
Does it have the “Objective” part? I thought Objective CAML’s OOP model was kind of interesting.
I see a couple of uses of “declarative” above in a sense that I think may be confusing. Declarative programming expresses a computation as a sort of formula, as opposed to a procedure – which is exactly what functional programming is about. C# et al., not so much.
Yes, many here have gotten the impression that F# is strictly a “pure” functional language. It can be used that way, but like OCaml, it supports functional, imperative, and object oriented programming.
Besides that, even “purely functional” F# programs that make use of objects provided by other .NET assemblies inherit the non-functional nature of those assemblies (depending on what methods the F# program calls).
For those of you who want something on the Java side take a peek at Scala[1]
Not purley functional like F# though, but instead a mix of OOP and FP
[1] http://www.scala-lang.org/