Slashdot Mirror


Functional Languages Under .NET/CLR

Numen writes "With all the talk of .NET being thrown about there is a common factor occuring through many discussions, namely the claim that .NET will be unable to address functional and logic languages such as Prolog and LISP. To this end I would like to drawn peoples' attention to two resources, that shown how this may well be a non-issue, and to ask, does this change anybodies mind? "

20 of 344 comments (clear)

  1. Look deeper... it's not that bad. by SID*C64 · · Score: 2, Informative

    Since many probably won't read past the first page, look at this link which describes in detail Mercury on the .NET framework. It's not bad.

  2. Mondrian for .NET by cdmoyer · · Score: 4, Informative

    Another good example, as covered in Dr. Dobbs last issue, is Mondrian. You can read a paper about it here(it's a PDF). You can download the compiler and view documentation at the mondria-script web-site.

    Here's a blurb from Dr. Dobbs:
    Mondrian is a modern, purely functional language specifically designed to leverage the possibilities of the .NET Framework.

    --
    /* CDM */
  3. The problem by Anonymous Coward · · Score: 1, Informative

    The problem hasn't been that you can't implement some functional languages with CLR and ILR. The problem is that to implement a particular functional language (scheme and common lisp spring to mind) you've had to drop some functionality (in fact, do a partial implementation). Will this be addressed? Who knows? I note that the first passes at Python.NET and Perl.NET ran into the same sorts of problems and ended up with a comprimise of integrating with the .NET stuff but not an implementation under .NET.

  4. Re:Who thought this? by relinquish · · Score: 3, Informative
    As far as I understand the issue is a performance one.

    For example, scheme is hard to compile towards the JVM or standard C because both lack proper tail call implementation (poping the parameters in the stack before calling a function in tail position).

    You can of course circumvent this because as you say the target language is Turing complete, but you lose a lot on performance if the target isn't tailored to this particular use.

    --
    Relinquish
  5. Re:What about speed? by jguevin · · Score: 2, Informative

    I can't speak to application development on .NET, but I can say for web apps that ASP.NET is very fast, particularly in comparison to "interpreted" approaches like ASP 3. The improvements in organization are fantastic as well. Nearly everything we've had to implement an embarrassing hack for on ASP has been replaced by a clean, well-thought out bit of code.

    That said, initial compiles of ASP.NET pages are sorta slow, about 5-10 seconds per page on the first run-through, but after that the only bottlenecks seems to be at the DB.

  6. There is no such thing as "Turing complete" by yerricde · · Score: 2, Informative

    As long as the language is Turing-complete, it should be possible; the question is in the level of difficulty

    No physically implementable computer system is Turing-complete, as a Turing machine has an unbounded storage tape. Even C on a 64-bit architecture isn't, as it limits you to only a few exabytes of memory.

    --
    Will I retire or break 10K?
  7. Re:Who thought this? by affenmann · · Score: 2, Informative

    > As far as I understand the issue is a performance one.

    Yes, the problems seem similar to the attempts to compile functional languages (e.g. Haskell or ML) to the JVM.

    Functional languages have a lot of very short lived objects (functions that are evaluated) without identity and local storage.
    The JVM (and .NET) are designed primarily for object oriented langages having long(er) lived objects with identity and storage.
    It's this mismatch that makes it hard to use functional languages *efficiently* with .NET.

    Anywat, I really love to see the people at MS addressing this problem. But after all, GHC, *the* Haskell compiler is being developed at MS research.

  8. Haskell by hoggy · · Score: 5, Informative
    Given that one of the main brains behind Haskell now works for Microsoft Research and has always been a strong proponent of FP on commercial platforms - I'd be surprised as heck if the Glorious Haskell Compiler wasn't targetting .NET real soon.

    I took a look around and found this link to a guy called Don Syme at Microsoft Research who appears to be working on just this.

    There's also the Mondrian project, which implements Haskell.

  9. What a major Lisp vendor says: by OOPChugALug · · Score: 2, Informative

    I recall an interesting commentary on this very topic by a Lisp Developer at Franz:

    See http://groups.google.com/groups?hl=en&frame=right& th=b55cb0947065a389&seekm=48zh6nn1q.fsf%40beta.fra nz.com#link2

    Obviously, the vendor may have reconsidered their point of view. (I have no association with this company)

    Excerpt:
    "
    rcena@epcor.ca (Resty Cena) writes:

    > Is anybody working on a Lisp port to the .NET platform? Seems to me
    > that Microsoft .NET is a wide-open side-door for Lisp to enter into IS
    > shops.

    We at Franz looked at it, and rejected it. The major reasons for
    us deciding not to proceed were

    1. It would slow our lisp down tremendously. I don't rememeber the
    exact estimates, but I would guess and wouldn't be surprised if
    the slowdown would have been on the order of 10x.

    2. More than a hardware emulation, where the "hardware" provides
    primitive functionality and we language vendors are able to use
    this functionality however we see fit, .NET is a framework in which
    software is constrained to conform. Thus, we would have to change
    our calling sequence, object, typing, and gc architectures to
    conform to .NET's.

    3. The result would be MS specific, and not portable to other systems.
    This point is weak, because it is conceivable that .NET will be /
    is being ported to other operating systems, but at the time we
    looked at it, it had no buy-in from any other operating-system
    vendors.

  10. Tail calls and dynamic typing by yerricde · · Score: 2, Informative

    Anything one could do in native assembler, one could do in IL or JBC.

    Not if the language doesn't support constant-space tail calls, which are the primary method of iteration in the Scheme programming language, and which can be implemented with a jmp (or whatever it's called) in any silicon CPU's assembly language. I've read that Java bytecode doesn't support it, but Microsoft added a tailcall instruction to MSIL at the request of compiler developers.

    The Java platform's VM and the CLR both require code to be type-safe. How does this mesh with the dynamic typing (in .NET framework terms, everything inherits from System.Object and all variables are of type System.Object) that some functional languages use?

    --
    Will I retire or break 10K?
  11. Re:IL, like Java Byte Code, is simply assembler by Anonymous Coward · · Score: 1, Informative

    Anything one could do in native assembler, one could do in IL or JBC.

    Incorrect. Java byte code doesn't allow many things that you can do in assembler, for example read from a memory address, call a function in memory (basicly anything to do with memory pointers). These restrictions make it hard to generate effecient byte code for languages like C and Lisp.

  12. Initialization speed and bytecode verification by brad.hill · · Score: 3, Informative

    Part of Java's slowness in initializing is that it does extensive security oriented bytecode verification of every class loaded. If .NET doesn't do that, it will be faster, but arguably not as secure against people rearranging the CLR bytecodes in ways that a compiler conforming to the security spec wouldn't. BTW: You can disable this as a command line option to your JVM and speed things up if you trust your .class files, but the default is to be secure.

    1. Re:Initialization speed and bytecode verification by Anonymous Coward · · Score: 1, Informative

      The CLR does check type safety and context security at runtime.

  13. Re:boy, good thing by Anonymous Coward · · Score: 2, Informative

    There are more applications than you may
    think.

    http://www.franz.com/success/

    Here, I included a few of them....

    Pro/ENGINEER

    Ascent Technology, Inc.
    Application: ARIS

    PricewaterhouseCoopers
    Application: Comet and Planet

    NASA
    Application: Mars Pathfinder Mission's Planning System

    Space Telescope Institute
    Application: Spike: Hubble Telescope Scheduling System

    Square USA Inc.
    Application: Phantom

  14. .NET And Multipule Languages by MissingNetLink · · Score: 2, Informative

    Here is an interesting article to you who think your
    language will get the same level of support under .NET http://www.javalobby.org/clr.html

  15. For anyone interested by a3d0a3m · · Score: 1, Informative

    Here is a link to an introduction to Moscow SML implementation, which has alot of good beginner info. And here is a link to SML .NET info, which is what you'll need to use to code SML apps for windows.

  16. Re:What about speed? by RubberMan · · Score: 2, Informative

    I did some some simple tests on this the other day out of pure curiosity. I don't expect the numbers to tell the whole picture by any means but it is enough for one to want to investigate further. I simply created a small console based app that checks to see if a number is a prime or not for 80000 numbers. I wrote the code in java, C# and C. Anyway, here are the results I found:

    Java (IBM 1.3) 4496 ms
    C 4716 ms
    C# 8582 ms

  17. Hell is freezing over and pigs are sprouting wings by telstar · · Score: 2, Informative

    Could it be? Are there some positive posts regarding a Microsoft technology on Slashdot?

    I've just started to scratch the surface of what .NET has to offer, but from a performance and price standpoint it certainly has a lot to offer. If Microsoft can tighten up their security and keep the price and performance where they are ... they look to have a very formidable product.

  18. Re:Continuations & Scheme by daytrip00 · · Score: 2, Informative

    If that's your worry, then it is justified. There was an interview on MSDN (The .NET show) with the program manager of the CLR group (I don't remember his name) and he said the one thing that you couldn't do in the CLR was continuations. He especially lamented this because Scheme was his favorite language.

  19. Re:GNOME and .NET change of heart by elflord · · Score: 3, Informative
    I have to disagree. First of all, it being illegal to pay them less means nothing. I think there's a loophole with consulting companies. They can bill at the same rate as citizen, but pay the slave^H^H^H^H^Hconsultant whatever they want.

    A friend of mine worked at one of these consulting companies, and their salaries were actually pretty decent. Of course, an anecdote doesn't prove anything, but suff"ice it to say, I am sceptical. However, I think the H1B visas should require a minimum salary.

    This is going to show my redneck heritage, but I believe this - we can't afford to have a bunch of non-citizens in the USA stealing jobs from citizens by undercutting us in every way.

    Well that's too bad, because the alternative is to have a bunch of non-citizens out of the USA stealing jobs from citizens by "undercutting" you.

    What we have with the H1Bs is the recipe to economic collapse, rapid inflation, etc.

    There's little in the way of evidence to support this claim. I would argue that on the contrary, isolationist policies are a sure recipe to doom. The problem is that there is change due to the unsustainable situation where people in India have much lower salaries than their American counterparts. Because of this, it's in the interests of companies to prefer the Indians, and fire the Americans since they're cheaper. A lot of people are getting burned by the transition (this always happens when economies undergo any type of transition) The key is to put the brakes on the transition so that no-one gets burned more than necessary.

    Just look at the early 20th century immigration boom. That eventually led to the great depression, which led to WWII.

    Post hoc ergo propter hoc. Lots of things led to the great depression (ponzi schemes, a poorly regulated stock exchange, and an unsustainable boom), and lots of things led to WWII (namely, Germanys hardship had a lot to do with the "victors justice" at the end of WWI