Slashdot Mirror


Inside Microsoft's New F# Language

robyn217 writes "There's a new language being formed in the bowels of Microsoft. Recently I got word that the language F# (pronounced F Sharp) is nearing workable stages at Microsoft Research. So, I went in for a look-see. What I found was an interesting blend of imperative (Java, C#) and functional languages(it's ML-based, too!). It looks pretty enticing to me from a computer science perspective, but I'm not sure it would fly in the professional market. I can see the ease of development that a language loosely based on ML would bring, but I can't see coders switching over in droves since it's a tough learning curve." Our previous story on F#.

21 of 606 comments (clear)

  1. Re:Well... by henbane · · Score: 5, Insightful

    F# will be learned by people when managers and not university lecturers decide that it is something that coders need to learn or even when coders decide it's necessary for something.

    Stop thinking that the world is out to make you use MS products no matter what. The businesses that do the employment and the people who should be advising them (cough -you- cough) are the people who make those decisions.

    Anyone learning Computer Science should in no way be gearing themselves with any particular product

    Any university offering courses in computer science is doing students a dis-service if it sends them out of the institution without an MS-centric, Linux-centric or any other square peg solution to fit any hole they come across.

    I always thought the aim of education and particularly any discipline that considers itself a science was to teach skills and thinking which could be applied across the field so the graduates would find themselves able to adapt to any language or equipment that they found it necessary to use.

  2. Re:Figures... by AntonyBartlett · · Score: 2, Insightful

    I usually use an F#-word or two when dealing with *any* programming language. Even those who swear by computers also swear at them.

  3. Re:Well... by Anonymous Coward · · Score: 2, Insightful

    I don't buy this for a minute. There's tons of comp sci programs that never even made the switch to Java as their "learning" language. People will learn what the job market dictates. There will ALWAYS be a need for COBOL and C programmers and I think that Java has, sadly enough, become ubiquitous enough that we'll always need Java programmers.

    You'll lose your job if you only know a handful of trendy technologies and nothing more. If you know some languages that are passsing into the "legacy" category, you're better off.

  4. Filters by alexjohns · · Score: 2, Insightful
    Considering that most corporate mail servers filter pretty much all email containing variants of 'F*', 'F#', 'F###', etc., I really don't see how this could possibly catch on. Certainly not in large corporations. Maybe MS will need to start a grass-roots campaign.

    And, you know, I've been working for a very large financial institution for 2.5 years. I've seen no sign of C# anywhere. Going to the programming racks at Borders would make you think differently. I honestly think there's more C# books out there now than all other programming language books put together. It's amazing.

  5. Re:Wrong... you couldn't.... by xenocide2 · · Score: 4, Insightful

    Which only goes to show how much cleaner mapping functions to lists is.

    map (fun x -> x*x) list

    --
    I Browse at +4 Flamebait

    Open Source Sysadmin

  6. Re:Gee Flat by sammy+baby · · Score: 3, Insightful

    I'd hesitate to say it's a "bright scale" in and of itself. The intervals between tones are the same in F# as in C#, which is why the whole circle-of-fifths thing works in the first place. The brightness or moodiness of the scale is entirely dependent on the range and tonal qualities of the instrument on which it's played - try it on a piano, and one doesn't really sound brighter than the other.

    And besides, everyone knows that D minor is the saddest of all keys.

  7. Why I like Java... by Eric_Cartman_South_P · · Score: 3, Insightful
    ...the way I wrote a file to a disk 5 years ago is the same way I write it today. And I know how to write a file to a disk on Solaris, Linux, Mac, BSD and Windoze since I know the little bit of code that does it in Java. Although a simple real world example, it is pretty powerfull stuff when you think about it. And remember, NO RELEARNING.

    I know, AWT->SWING and a bunch of other examples, but a CORE PART of Java does not change. It remains the same as much as possible, in regards to the API.

    MS goes ahead and changes things completely every few years. Java, for the most part, does NOT require tons of relearning. The API's are there if you need them, but a majority of them do not change. They might get "cleaned up" a bit, or a few deprecated here or there, or in my opinion a few too many may be created to do the same task, but if you could knock up a Java prog years back, it's the same way today for the most part. SIMPLE.

  8. The best man by FuzzyDaddy · · Score: 2, Insightful
    Hire the best man for the job.

    I certainly wouldn't hire an insecure prick for any job. Especially if he was so insecure he was grasping for straws as to why he wasn't succeeding. You think because someone doesn't speak english without an accent they're stupid? How's your hindi?

    --
    It's not wasting time, I'm educating myself.
  9. Re:It's OCaml for the .NET CLR... by Zeinfeld · · Score: 3, Insightful
    It's OCaml for the .NET CLR. Not a new language. Nothing to see here. Move along.

    Yes, but the problem with most ML implementations is that they are academic toy languages. You can't do anything useful with them because you can't connect them to real I/O and if you can you can't distribute the code as noone else has the environment.

    Adding the dotNET classes to ML means you have a real programming environment for a functional language.

    --
    Looking for an Information Security student project suggestion?
    Try http://dotcrimeManifesto.com/
  10. Re:It's OCaml for the .NET CLR... by arkanes · · Score: 5, Insightful
    There's a signifigant inertia to overcome with the acceptance of any new language. One of the barriers is the creation of a useful runtime, porting that runtime to common platforms, keeping it supported, etc. There's a whole bunch of languages out there, but probably 90% of applications are written in less than a dozen of them (Java, VB, C, C++, Delphi... am I missing anything else major?).

    One way to overcome that inertia is to provide bindings for your niche language against a major runtime - like compiling it to Java bytecode, or, in this case, IL.

    Now, .NET has it's own inertia to overcome, but because it's Microsofts baby, it has alot of advantages that the language/runtime that Joe Programmer makes doesn't have.

    This is interesting for a couple other reasons - it's been reported before that it should be easy to port functional languages to .NET - and that it's apparently hard to have them compile to Java (I don't know crap about functional languages, I'm just parroting here), so here's the proof of that. Also, like it or not, .NET is very big and is being very heavily pushed by the single most influential company in IT - and if you're a fan of functional languages, I don't see how this is a loss for you or why you're bitter about it.

  11. Re:Funny quote of the day by Dan+Ost · · Score: 3, Insightful

    Seriously, though... I was discussing the future of programming languages with some friends and we agreed that a real step forward would be to provide features such as higher order functions in a mainstream language... could this be it?

    If you consider Python to be mainstream, then there's already a mainstream language that supports both functional programming and advanced types like lists and associative arrays (aka dictionaries).

    I stumbled on to Python about a year ago and have been so impressed by it that it's becoming my languange of choice for new development.

    Check Python out. Really

    --

    *sigh* back to work...
  12. Re:Why I like C... by Anonymous Coward · · Score: 1, Insightful

    C isn't as portable as perl, python, php or java

    Perl, Python and PHP are not suited to the same problem domains as C. Java is portable only to systems which have a full JVM, and then your success depends on the version of the JVM available and wether you are using AWT or Swing. If you use any JNI at all then your code is just as portable as C.

    perfect example is TurboC and that stupid conio.h file.

    Try sticking to the standard? The latest C standard was approved in 1999 (C99), or if you need to be compatable with older compilers there is still plain old ANSI C (C89). Both are perfectly portable if you stick to the C library (Which applies to Java just as much). If you're targetting a POSIX platform then your code is portable across that, too.

    My point is that there is nothing special about the portability of Java when compared to other languages.

  13. Re:Gee C# was so flawed that its already supercede by deacent · · Score: 2, Insightful

    The second level is for the tool makers. The guys who bring you APIs and services like TCP/IP, Tuxedo, database managers, OpenGL, compilers, browsers and the like. Those folks use C++ and Java. Its a mistake to think that you can make an application in C++ or Java or Smalltalk. You can cobble something together that will cost too much and be too brittle for real-world use and eventually break (or break the bank.) The world becomes real.

    I take issue with this. I have designed and implemented apps in both C++ and Java that were flexible enough that we were able accommodate unexpected customer requests. And they didn't break the bank, considering their feature set.

    Funny. I remember a time when folks used to believe that Java and C++ (and other OOLs) weren't fit for such low-level work because of the compilers/linkers tended to make the code pretty inefficient. I guess I'm showing my age. :)

  14. Re:That's how I feel about most Microsoft language by Unominous+Coward · · Score: 2, Insightful

    I think that if you examine the C# and F# languages, you'll find that they both fall flat.

    --
    "Smoking helps you lose weight - one lung at a time" -- A. E. Neumann
  15. Re:Funny quote of the day by jaoswald · · Score: 3, Insightful

    What's "wrong" (rather, missing, or inconvenient) is the ability to fill f with pointer to functions that were not defined when the compilation happened.

    In Lisp, I could take the contents of a Web form, for instance, and use that to make a function that would encode, for instance, your preferences in music, then use that newly-formed function to rate MP3's as your are browsing.

    (defun make-rating-function (web-form-contents)
    (lambda (music)
    (+ (* (country-rating web-form-contents) (country-genre music))
    (* (rock-rating web-form-contents) (rock-genre music))
    (* (classical-rating web-form-contents) (classical-genre music)))))

    Then, that rating function can be stored in a variable for later use on the music.

    You could implement this in C, by storing the array of three values, but it is much less flexible. My make-rating-function could return one out of any number of functions, which take different information out of the web-form-contents. For instance, classical music listeners have very different ways of choosing music, so you would give them a music-rating-function that looked at composers more than performers, while rock fans would look more at bands that groups of people tend to rate similarly.

    (defun make-rating-function (web-form-contents)
    (if (classical-music-lover web-form-contents)
    (make-classical-rating web-form-contents)
    (if (rock-music-lover web-form-contents)
    (make-rock-rating web-form-contents) .....

    where make-rock-rating is written as above.

    Once you make the choice of functions depend on the data, it becomes cumbersome to do in C. It's like doing polymorphism in C: you need to start making case statements all over the place to check what kind of customer you are dealing with. Lisp makes this kind of stuff easy to express---dealing with functions is as easy as dealing with integers and floats.

  16. Re:Could be useful? by iabervon · · Score: 2, Insightful

    The .NET CLR was designed for C#. None of the other .NET languages are any better for anything than C#, because every feature that isn't in C# has been removed from the other languages to make it a .NET language. It's not actually more generally applicable than the JVM, it's just that there's a bigger marketting push to demonstrate that you can implement a bit of a lot of languages on it.

  17. Re:Gee Flat by $carab · · Score: 2, Insightful

    Most people think (D flat) instead of C#.

    Most people think of the note as C# because it is the third sharp added as you move up the circle of fifths. The A major scale includes a C#. D flat, on the other hand, does not arrive until 4 flats, in the A flat major scale. As a string player, I can tell you we play in multiple sharps far more than multiple flats (Who ever heard of a violin concerto in A flat?).

  18. Re:Why I like C... by MisterFancypants · · Score: 2, Insightful
    C isn't as portable as perl, python, php or java. C and C++ suffer from either incomplete or random interpretations of the specifications.

    That is one of the most ridiculous things I've ever read. What are Perl, Python, php and Java implemented in? C! If C wasn't portable enough to run on all the platforms those languages do, those language's runtimes wouldn't compile on those platforms!

    Find me a platform that runs any of those languages that doesn't also have a gcc port that allows you to write portable code in C.

  19. Re:That's how I feel about most Microsoft language by Dwonis · · Score: 2, Insightful
    If you don't like it, submit a patch to the API!

    Oh, wait...

  20. Re:I like the idea by Anonymous Coward · · Score: 1, Insightful

    Golly! You mean to tell me these five line (correct, working, and polymorphic) versions of quicksort aren't fully optimized? Say it isn't so! Tell you what, rockstar, you show me your thee line fully optimized quicksort and I'll show you mine.

    Look, the point of these examples is to give a taste of the expressiveness and declaritave nature of FP languages. If you are in one of those special cases where you need to worry about space constraints, then you can feel free to use ML's imperative features to sort an array by modifying it in place. Or if you want to avoid the "sorting an already sorted list" problem, feel free to write a median-of-three version of quicksort (or use merge or heap sorting which don't ever have this problem).

    -30-

  21. Re:Funny quote of the day by jaoswald · · Score: 2, Insightful

    I have just scratched the surface of Lisp's dynamism. Sure, for any fixed set of example functions, you can create the same structure in a static language.

    However, in Lisp, I can *redefine* functions continuously, and previous references to those functions remain intact.

    At any point, in my web server example, I could change the definition of any one of the generating functions, *as* the program is running, without stopping and recompiling the whole program. This kind of dynamism is pervasive throughout the language, and not just in some special libraries one can decide to use. Moreover, I don't have to fit my problem into the framework of inheritance, if it isn't natural.

    Conceptually similar does not mean equivalent in power. Lisp has been doing functions for almost 50 years now. The C++ community is just beginning to get the vaguest idea. It's the difference between real French cheese, for instance, and "american" "pasteurized processed cheese product." Big difference between the real thing and a crude imitation.