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?
"
The Terrarium game alone is enough to make me try .NET
I'm probably going to loose badly but I'll keep on trying. I'll probably use the : [assembly: OrganismClass("NakedBabe")]
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.
What I don't get about Physics is, years after my last U-Grad Physics course I STILL havn't found that frictionless frozen pond.
All your base are belong to us!
I think that it may just be a little early to have a release at all considering all that.
Comment removed based on user account deletion
After reading Miguel's long response to the Register article, I've really changed my mind about .NET architecture. I think I'm going to get a book and start learning it, maybe try to contribute to his effort.
Moderation: Put your hand inside the puppet head!
"To this end I would like to drawn peoples' attention to two resources,"
The first link has nothing about "peoples' attention", and "two resources" has only one document linked. Where's the other resource?
What's with Slashdot and stupid/misleading linking..
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.
.NET Framework.
Here's a blurb from Dr. Dobbs:
Mondrian is a modern, purely functional language specifically designed to leverage the possibilities of the
/* CDM */
What basis for thinking this would anybody have?
.NET would be harder to support than, say, TCP/IP or HTTP. I mean, Emacs was written in LISP; if they can do that, is .NET such a challenge?
As long as the language is Turing-complete, it should be possible; the question is in the level of difficulty, and I don't see why
Perhaps I've misunderstood the claim; in that case, perhaps it would've been useful for the poster to include a link detailing the rationale behind the claim that functional languages wouldn't work.
you just dont know where to look. it is right next to the perfect sphere and the infinitely long cylinder.
Haha you weenie.. Real programmers will use C#, C++ and C.. May I laugh in your face? You're considering C for real programmers? You obviously have never heard about The Story Of Mel... C.. pff
Does anyone know how .NET does for speed?
.NET introduce an even bigger overhead, or have they sorted it out?
.NET instead? Will the tailor-made version be more efficient because it's designed with the language in mind, or does the benefit of having all the optimisations done on a common system compensate for that?
ie, Java takes an absolute age to initialise which makes it unsuitable for desktop applications or utilities (although people still try... maybe in a few years' time...).
Does
Also, is there any overhead for languages that aleady use a VM (eg, python, perl) if they switch to
I really like the idea of a common cross-platform runtime, but not if it makes my text editor take 5 seconds to load!
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.
all four Prolog and LISP Win32 applications developers were getting nervous.
nice solution to a non-issue.
I dont think anybody seems to have a great problem with the technology - ie bytcode and VM's - although it seems rather premature to be thinking of applying it to GNOME at the moment. Get some medium sized apps running under Mono first before crippling GNOME with something that isn't ready.
;-)
The real problem is Microsoft. It might be a cool technology, but Microsoft wont think twice before taking their ball and going home with it.
Mark my words: If it happens, it'll all end in tears.
Could work out well for the KDE guys though
Tales from behind the Lagom Curtain
Well, it was obvious from the beginning that the Sharp/Cool Virtual Machine (or whatever it is called now) could only support 'heavily Sharpenized' languages. Just look at the die-hard VB newsgroups to see their opinion about the "vbnet" syntax.
t ml )
Exactly the same as the many different "languages" available for the Java VM. ( A nice list, by the way! Have a look here: http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.h
However, invoking the VM from another language is an entirely different issue. What about "Managed LISP" ? Could it be useful?
The SML.NET compiler hasn't yet been released by Microsoft Research but hopefully it will be soon. As I understand it, it is a complete implementation of Standard ML, with a few (small) extensions to hook into the .NET object model.
In my opinion, this could be one of the best opportunities functional programming has to gain mainstream acceptance, because of the ease with which it will be possible to link functional code with imperative code.
Let me ask you all a question: If any language that you currently use is compiled into native machine code (for x86, or PPC, etc.), then why wouldn't .NET or the JVM support it?
You have to remember that both IL and JBC (Java Byte Code) are essentially virtual CPUs that have some high-level features tacked on to simplify implementing certain kinds of langauges. However, they are still just basic assembly like langauges. Anything one could do in native assembler, one could do in IL or JBC. In fact, not trying to support one or the other, IL is probably a slightly better candidate here because Microsoft uses it to compile to native x86 assembler. Hence, there is support for direct memory manipulate (something the JBC doesn't have).
So, can someone implement Lisp using IL? Why not? They did it with C or assembler before. Can someone implement Smalltalk? David Simmons already has at http://www.smallscript.com.
I applaud Miguel for trying to bridge the gap between the Windows and *nix world in innovative ways. Good luck!
.
:-)
... who cares...
You should say "unless you call it MS C# " .
The first 2 letters are the decisive ones for market adoption.
The following ones can be anything you like: C# J# Cool#
has never materialized. It's nice from a theoretical point of view but for all practical purposes functional programming has never delivered.
no sig error.
Every decent implementation of Lisp that I know of comes with CLOS (Common Lisp Object System).
The Gimp
DSSSL
Both developed in Scheme
Why?
It solves problems. Let's assume it solves problems. Such as, you can write in different languages. Even use objects as objects (!) in different languages. To some extent. That is the impressive part.
There is also a virtual layer. It has been compared to the JVM. I am not going to compare it to the JVM. I am not even calling it a virtual machine. That is not to disparage the effort -- but .NET is much bigger than just a virtual machine. One could also convincingly argue that a virtual machine is not, ultimately, the most interesting part about efforts such as .NET.
Efforts such as .NET. What kind of efforts are there that are like .NET? What is .NET? Nobody seems to know, really.
It is good to see that the .NET APIs and interfaces are being picked up. This is most certainly where a lot of .NET value is. Perhaps even most of the value. Who knows? Of course there is a lot of geewhiz computer science in .NET that you could also point out as desirable. The Python and Eiffel crowds will know. But personally; I believe a good solid API is worth a lot of, um, computer science.
Just to indicate how broad .NET really is. There is something there to please everyone. It's "virtual", but in a comfortably ill-defined myriad of senses, and it's great computer science, but it also means business.
If it succeeds, it might almost bring Microsoft in line with the rest of the computing world (UNIX). That is, peer review, sane architecture, sane libraries.
Right. So what is wrong with GNOME that can't be fixed without first creating, then resorting to Mono? Well, we don't have all the language bindings that .NET would offer. We would get a uniform API across languages for many things. Well, actually of course we would get excellent integration for oft-used languages, and languishing thesis project kind of support for lesser used languages.
Which is pretty much the way it is now. If you want to do text, you use Perl. If you want to do anything else, you use C. If you want to get virtual and a headache, you use Java. If you want to do computer science, you use Python.
Does anybody really believe that this will be any different under .NET? And when? How long will it take before we even reach that point? Would that time not be better spent making GNOME even better than it already is? How about writing some more documentation? If writing hundred lines of documentation fixes 400 potential errors now, versus .NET fixing thousands of potential errors in two, three years time -- what constitutes the better investment in our freedom?
Pushin' 'n dealin', shovin' 'n stealin'
A lot of the debate about .NET and the open source focuses on the technology, and not the strategy.
.NET? Well, .NET is a technology, but it is also a strategy. Its aim is to completely dominate software development in the future.
.NET to be successful, they need to win developers over to it. In order to do that, they need to give the appearence of it being an open and non-threatening platform to use. But that's only appearances. Their aim with .NET is to completely dominate the provision of any type of software service over the internet (which will include pretty much everything within a decade) and to get their slice of every transaction made.
.NET. If you think you will ever beat Microsoft by playing by their rules then you have your head in the sand. Think about what contingency plans Microsoft might have in place. Remember that they have a war mentality - what would you do if you were Microsoft? Think about the Haloween memos.
.NET strategy still vague, when Microsoft is "betting the barn" on it?
Let's consider some facts first. One of Microsoft's basic strategies is the complete domination of markets. They make no secret of this (although they have not been successful at it outside of the desktop space). Here are some instances where senior Microsoft people have stated they want to completely dominate a market:
1) Internet access with MSN.
2) The handheld market with Windows CE
3) The game console market with X-Box.
In all three cases above, they have made it clear that they intend to dominate that market, and have even stated that it is "the Microsoft way" to do so. They're not interested in 50%, they want 100. Admittedly they haven't yet been successful in this any of the above markets (in fact I think we can now safely say that they've failed with Internet access), but that is their intent.
So, what has this to do with
Now, Microsoft's strategists will have spent a long time thinking about this. They will have hypothosized about potential problems, and developed contingency plans. Microsoft knows that in order for
That's why I despair when I hear people in the Open Source community talk about implenting stuff in
Has anyone, for instance, looked through all Microsoft's patents, to check that their isn't a surprise that they could pull out of the sack if things aren't going their way? Has the Gnome Foundation, for instance, got the financial means to defend itself should Microsoft attack it legally? Why are some parts of the
.NET is perhaps great technology. But I implore everyone in the OSS community to stay away from it. Bill Gates will tell you that the best technology doesn't necessarily win in the long term, it is what has mindshare. OSS is getting more mindshare every day. Don't help MS by supporting their technologies. Your software project will get killed if it starts to threaten MS if you do.
.NET is just another one of Microsoft's over-engineered solutions. It looks simple on the outside, but when you get down to it the complexity is overwhelming. It's really sad to see so many open source developers being lulled by Microsoft's latest technological tactic.
.NET well!
Who out there remembers DDE, OLE, MAPI or DocObjects? How about MFC (.NET 0.5...)? If you do, remember how well (not very!) these "technologies" worked outside of the boxes Microsoft created them for? Has anyone out there actually tried to work with, for example, Exchange server?
Microsoft fears clonability, and to prevent it they create complex APIs with lots of hidden underspecifications. Then they get developers on board by creating pretty, easy-to-use tools and hosting big developer conferences. And they make it feel cool through shrewd marketing. But at the end of the day, you find that you've spent 90% of your time trying to work around some deficiency. And it's not because Microsoft was especially dumb when implementing this stuff, its just that the stuff is needlessly complex to begin with!
We're doing fine as we are. Don't drink from the
CLR is no big deal. It's basically a clone of parts of the Java framework. As with any programming environment, it's the API's that make things happen. The CLR claims "language independence" but in reality it favors languages that look and quack like C#.
... well, it's a pretty safe bet that the .NET version of Visual Basic is going to generate code that makes calls to lots of Windows-specific, unpublished, and possibly patented API's. Forget about running them under Linux, ever.
.NET framework will revolutionize programming. It's just the new way for Windows developers to write Windows programs that run on Windows. So what? If you want true cross-platform ability, you write it in a portable runtime environment like Java or Python, or you write to a portable toolkit like Qt or wxWindows.
.NET framework might do for us, however, is create a Windows platform on which more apps are well-behaved. This would mean that once WINE is able to successfully run the DLL's that implement the .NET framework, all apps built on that framework will begin to run properly. I'll take that much.
... that scares the hell outta me. Rather than obscure the API's, they simply put 'em right out in the open, slap a patent on, and stand an army of lawyers in front of us saying "don't even think of cloning this." Dead stop. We have to avoid this at all costs.
But the API's
I'm singularly unimpressed by claims that the
What the
But the patent stuff
Tired of FB/Google censorship? Visit UNCENSORED!
Why? One major advantage of functional programming languages for optimization is that the compiler knows that almost nothing can change behind its back: variables can't get updated, data structures can't get changed, etc. With VLIW architectures like Itanium and hyperthreading, functional programming languages can potentially do much better relative to traditional languages than on older processors. But in order to so so, their compilers need a degree of control over code generation that simply isn't available if you go through CLR or JVM.
Furthermore, the entire runtime of a functional language is optimized for the kinds of allocation patterns that come along with functional programming, while CLR and JVM are optimized for OOP. For lazy functional languages, there are some additional issues when it comes to expressing lazy evaluation efficiently.
Altogether, though, I think it really doesn't matter. CLR and JVM are good and fairly flexible platforms, but platform evolution won't stop here. If anything, Sun is a bit more honest in this regard, making no bones about the fact that JVM is primarily a Java platform, even though there are dozens of other language frontends available for it; CLR claims universality, but really isn't any better than JVM.
If you don't care that much about performance, you can use your functional language under CLR and JVM. If you want a high-performance functional programming language, you can use one of the dedicated native code compilers and runtimes that will continue to be available. CLR and JVM will not end the evolution of other runtimes.
Yes, any language can run just fine on the CLR. However, not all .net-tweaked languages are created equal: C# is the only language that does not carry a performance penalty for writing managed code...the others are either ports or are inherently limited.
.net world (as they should be), so MS changed a lot in the language to allow people to write performant apps. However, old VB code is still dog-slow.
.net is pretty obvious: you lose tail-call optimizations, since the security model depends on the stack. This is one of the biggest drawbacks to writing fast functional code on .net, and it seems that there's no way around it without ripping up the security infrastructure and putting in a new one.
For example:
Visual Basic makes use of exceptions as part of control-flow manipulations. Those are very expensive in the
Managed C++ isn't bad for performance, though the syntax is ever worse than regular C++. If you want anything approaching native speed though, you will want to stay away from the garbage collector (virtual method invocations are very expensive in GC'd objects, since they require a jump out of the managed world into the vtable and then back in again).
The problem with functional languages on
E
Whilst .NET as a concept may be wonderfull, if the industry doesn't demand support (and a lot of companies won't) for OSS and Free Software compilers, these will be less of a priority. People who demand support for OSS and Free software compilers are not neccisarily where the money is (they roll their own). It's fairly obvious when things are funded in a non-grant way.
Does the future of the internet really belong in the hands of companies who may be hit by recessions? Open Sourcing, real Open Sourcing, keeps ensuring that a product lives on. Shit, you should see some of the wonderful stuff produced at Xerox-PARC, which got really screwed, a lot of it hasn't lived on because it wasn't Open Sourced.
I think maybe if Microsoft did opensource everything they would dominate the market still because they'd still be the experts. They'd probably marginalise Linux too. Especially in the third world, China and India.
I seriously doub Microsoft could go the same way as Xerox but I imagine people said that about Xerox.
- John
e4 e5
Check out Project 7. Microsoft is funding development of a variety of functional language front-ends for .NET including Scheme, SML, Mercury, and Haskell. Dan's work has been to provide a higher-level IL than MSIL (CIL) that may make writing a front-end for functional (or some object oriented) languages easier. AFAIK the Haskell front-end is the only one using Dan's higher-level IL.
Microsoft And Yale Conclude Agreement To License Technology For Haskell
.NET is something our customers and ISV partners think is extremely important," said Erik Meijer, the new senior vice president of Internet platforms and tools, at Microsoft. "It brings a whole new dimension to Haskell: a clear path for integration with existing applications, systems and technologies. It means that you don't have to start over to take advantage of Haskell."
Microsoft Demonstrates Haskell-Compatible Browser and Tools
NEW HAVEN - Feb 7, 2002 - At a press conference today Microsoft Corp. (Nasdaq: MSFT) announced it has concluded an agreement to license the Haskell programming language and related technology for inclusion in Microsoft products. As part of this agreement Microsoft will develop and maintain the reference implementation of Haskell for Windows(R) platforms, such as the Windows(R)98 and Windows NT(R) operating system.
Also, Microsoft demonstrated a number of Haskell-compatible technologies collectively code-named "Curry." The technologies demonstrated included Haskell support in the Microsoft Internet Explorer 5.0 Web browser using a built-in, high performance just-in-time (JIT) compiler; an integrated development tool Haskell; and integration of the Haskell language with industry-standard component object model (COM) objects through Microsoft ActiveX(TM) Technologies for the Internet and PC. Microsoft further outlined its plans for Haskell support, indicating that future versions of Microsoft Internet Explorer for Windows and Apple(R) Macintosh(R) will include the ability to run Haskell applets distributed through the World Wide Web. The company also outlined plans to create a high-productivity development tool for Haskell, based on its award-winning Developer Studio technology.
Microsoft is currently being sued by Sun over trademark infringement issues relating to its licensing of Java technology from Sun. A U.S. District Court judge granted Sun Microsystems Inc.'s request for a preliminary injunction that prevents Microsoft from using Sun's Java Compatible(TM) logo to promote and distribute its Internet Explorer 4.0 and related products. In response, Microsoft has taken the unprecedented step of completely abandoning Java in favor of what they consider to be "a vastly superior programming language technology" in the words of Microsoft founder Bill Gates.
In a project that has been kept under wraps ever since the initial adoption of Java, a team of Microsoft researchers has prepared an alternative programming language for use in case of a serious dispute with Sun over the future of the Java language. After evaluating many programming languages, the team settled on Haskell as being the best alternative to Java. According to Chris Fraser, a Microsoft research scientist, "Haskell's polymorphic type system is far superior to the one developed for Java." Also, he asserts that "purely functional programs are the wave of the future: object oriented programming has reached a dead end." As other developers integrated Java into Microsoft products such as the Internet Explorer, this "shadow team" created secret versions of these same products using Haskell instead of Java. The team leader, Conal Elliott, asserts that due to the elegance and expressiveness of Haskell, his team was able to completely duplicate the work being done with Java using only a tenth of the manpower. As all tools needed to switch from Java to Haskell are already in place, Microsoft expects to completely purge its products of Java within a period of less than two months.
"Haskell technology will provide a great way for our developer customers to create innovative applications for the Web," said Dave Hanson, vice president of development tools at Microsoft. "We intend to be the premier supplier of Haskell-compatible tools to Internet developers."
"Microsoft's commitment to Haskell is both impressive and comprehensive, and this agreement makes them one of the leading Haskell supporters," said Paul Hudak, the former head of the Haskell committee. "Microsoft's licensing of Haskell broadens support of the technology significantly."
"Integrating the Haskell language with
Current Haskell developers reacted with both joy and concern at this announcement. Simon Peyton-Jones, a prominent Haskell implementor, said "I guess this means the end of our research efforts here. There is no way a small research group such as ours can compete with Microsoft." At Yale, Alastair Reid was more optimistic: "Now I can get out of this hellhole in New Haven and get a real job at Microsoft." In fact, many Haskell developers are expected to join a new Microsoft research group in Nottingham, England which will be headed by Mark Jones, a prominent Haskell researcher. Dr. Jones explained that "they wanted me to come to Redmond but I decided to remain here in Nottingham. When they decided to build a research center here for me I was thrilled!"
Additional information on Microsoft Corporation is available on the Internet at http://www.microsoft.com. Additional information on Haskell is available on the Internet at http://www.haskell.org.
Microsoft Windows, Windows NT and ActiveX are either registered trademarks or trademarks of Microsoft Corp. in the United States and/or other countries.
(spoof reproduced from http://haskell.org/humor/press.html, originally released 1 April 1998)
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?
October_30th wrote:
.NET is and always will be a Microsoft initiative and property.
.NET
Uh... what exactly made you change your mind?
In my opinion, Miguel was just avoiding answering the real issue:
This is a valid question followed by his opinion, so why is it modded down to -1?
I for one (and I'm sure there are many more) would like him to explain how he resolves many of the arguments from those who voice against
I always thought Insightful moderations from some offering Insight. This guy just said that his opinion changed after reading the article. Why? Give us an overview.
"Communism is like having one [local] phone company " - Lenny Bruce
To take one example, in Lisp you can pass nameless functions quite easily. So you might have a library that has a function to create a new button. One of the arguments to the function is a function that the library will execute when the button is pressed. In Lisp this is a trivial thing, you just create a function and pass it as the argument. But if nameless functions are not supported by the virtual machine, then this operation becomes very problematic.
What if the nameless function is created dynamically by the program? How can the virtual machine compile this nameless function to native code before running the program? Unless the virtual machine knows how to compile Lisp code, it cannot. It may be that the Lisp library must be changed to accept some other form of argument for the callback for efficiency reasons. If most of the work you do is just calling libraries and putting things together, you just lost one of the biggest features of Lisp. You have to trade off efficiency and convenience. If you use a native Lisp virtual machine, you have both efficiency and convenience.
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.
Making a call to an undocumented API from .NET would be the best thing for the OpenSource world. P/Invoke structures are incredibly easy to detect in CIL binaries, and because of the nature through which they load, they contain all of the ordinal and parameter information necessary for anyone to call them. However, you would be wrong. The Visual Basic specific libraries do use P/Invoke, mostly for COM, but it's all out in the open.
I recall an interesting commentary on this very topic by a Lisp Developer at Franz:
& th=b55cb0947065a389&seekm=48zh6nn1q.fsf%40beta.fra nz.com#link2
.NET platform? Seems to me
.NET is a wide-open side-door for Lisp to enter into IS
.NET is a framework in which
.NET's.
.NET will be /
See http://groups.google.com/groups?hl=en&frame=right
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
> that Microsoft
> 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,
software is constrained to conform. Thus, we would have to change
our calling sequence, object, typing, and gc architectures to
conform to
3. The result would be MS specific, and not portable to other systems.
This point is weak, because it is conceivable that
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.
kind of frightening how microsoft is pushing .NET as developer candy?
"Here kids, its cool, have some. What you want more, well, ya gonna pay. Start walking them streets."
-- moral: your gonna pay and get f**d
I don't care if MS is evil or has a monopoly or whatever the hell, I just want to use the best tools for the job. The thing is that MS always provided great tools for making simple apps but when you try to create something a little bit more advanced using MS tools, it was a pain in the ass. Did they solve that with .NET? I'm not sure. I used to be able to look at PHP and ASP code and quickly understand how it works; with the new ASP.NET, I look at the code and I get confused, I have no idea what code does what.
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?
Sure:
"Example for Syntax: identifiers. CLS identifiers cannot be disambiguated by letter case alone. This is incompatible with the behavior of most case-sensitive languages."
"The CLS only supports single, static inheritance. Languages such as C++ and Eiffel need multiple inheritance of implementation."
More funnies at: http://www.javalobby.org/clr.html
TH
I'm actually excited about the .NET framework (well, the CLR) because it will mean I can use my favorite functional language, SML, to write Windows apps.
It's also from MSR: http://research.microsoft.com/Projects/SML.NET/
Why do we care? In a really old thread I rant about the virtues of modern functional languages (and indirectly, SML). I think it's still relevant, though most of the other languages associated with .NET (ie, C#) have some of the same basic benefits now (like safety and portability). Here:
http://slashdot.org/comments.pl?sid=6343&threshold =1&commentsort=0&mode=thread&cid=929697
If you want to learn SML, or learn why I think it is so cool, maybe you'd like my under-construction tutorial called SML for Hackers: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tom 7misc/docs/sml/ml-for-hackers.txt?rev=1.3&content- type=text/vnd.viewcvs-markup
I'm not saying that functional languages are not better (it would be just ignorance of mine), it's just I haven't found any such problem yet, where functional paradigm would be any more convenient than procedural or OO.
Long time ago I didn't understand why to use object oriented languages, when the same can be done without OO. After a long time, I understood where OO is better. Now, I'd like to understand where functional is better, but it's harder, because functional languages are less popular than OO. They seem, however, to be used by hardcore hackers, so they are surely worth attention.
So... please show me (and others) the functional way of thinking! This is a serious problem, so please don't missunderstand it as a joke or something. Thanks.
Please mod it up so others could see it. I'm just a coward who wants to hide ignorance behind anonymity, and in the end, isn't that what AC posts are all about? :)
If Bill Gates died at the age of 32, that means he dropped out of college when
he was about 2 years old, and formed Microsoft at the age of 5!
Just goes to show you, he was truly amazing.
If they are willing to buy it, then it has to be for sale. If it is for sale, then the source is (usually) closed. If it is closed, we have no idea what it's written in. For all we know, MS Office XP is written in a combination of Scheme, Haskell, and Mondrian.
I was wrong about The Gimp. Not written in Scheme. Script-Fu uses Scheme. My bad.
You would open up your machine and allow mobile .NET code to execute on it? I'm not sure I would allow that with Java, which at least has been around for awhile and has a mature security model.
There's nothing new in this game, it could very easily be done with a JXTA or Jini framework.
Bill
----------------
Upon seeing the box was too small, Schrodinger's Elephant breathed a sigh of relief.
If Gnome did fully embrace Mono, would this mean that using Gnome on a Microsoft Windows/.NET OS would be possible?
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.
That's just because nobody uses it. I program in functional langauges almost exclusively, as do some of my friends, and we're having a great time. I think a good marketing force behind one of the modern functional langauges could make it really soar -- Java is a pretty mediocre language that has met with great success essentially because of marketing.
It is ok for me, that OS-Soft runs under Windows. But I have reason to not trust Microsoft. They regularly break promises. They want to use the Open Source Programmers as an additional resource for their Operating System - fine. But I also share the mistrust of Alan Cox and others, that they may change their politics. What will we do, if everything works fine for five years, Open Source keeps its market share (why should the MS-Share decrease, when every OS-tool works with Windows and people are accustomed to it?) and then afterwards MS invents a new patented feature, that is only licensed for Windows. And everybody wants to have it. Or they will change their license-policy. Then we will be in a much worse position than we are now - MS will then have the power of MS and the power of Open Source. And most Open Source Programmers will continue contributing to MS, because their programs will continue to run on Windows. And because there will be no technical reasons to migrate to 100 % Free Software, but some technical reasons to migrate to Windows, our share will shrink. Please think about that! Timeo Danaos et Dona Ferentes! küsschen
As more and more "modern" (i.e. well known for at least 10 years outside of the "mixed ability corporate development team") features you get closer and closer to lisp/scheme. Once you add closures, which AFAIK, the clr doesn't, you effectively have lisp with a different syntax. Well whoopie. I'd make the "flamebait" statment that any language might as well be lisp/scheme or lacks some feature that lisp/scheme has. The converse, that lisp/scheme lacks something that vb,perl,python,java etc. already has, is not true.
development.lombardi.com
Ok, so I'm a clueless idiot. Fine.
Here's your chance to impart some clue.
Just what is a "functional language" and why does [Language X] qualify but [Language Y] does not?
Thank you for any pending enlightenment.
First, an interesting thing about this is that .NET really boils down to an XML parser/generator (or does it? the whole thing is a nebulus blur (surprise! another nebulous blur from the corporate world that is going to change the world!)) And XML is really just
.NET? How well engineered can this thing be?
.NET nebula? Why spend time trying to warp any good tool to fit the jacket created by one company?
S-expressions, which is really the whole basis if LISP. And all this time has to be spent retrofitting lisp to
Having said that:
This is a great effort, and functional languages are my idol, but why spend all this energy trying to retro fit LISP to the
.NET is just another intermediate language. Are we going to go through this every time company X comes out with an intermediate language?
Of course, this isn't just company X, it is Microsoft. And just the fact that this matters is spooky enough. But the question still stands nonetheless.
Junis' C64 is faster than any beowulf cluster.
I hear MD5 hashes physically tremble at the thought of being cracked by our wacky Afghan friend.
Frankly, I'd feel more comfortable with the software ecology we have today than what we'll have once everybody catches mono(.NET). I want bright people everywhere to be thinking about things in as many different ways as possible. That way evolution moves forward. Robust ecologies have lots of organisms competing for survival... some of them surviving in little tiny niches for eons, and others can live just about anywhere. Monocultures have their problems: evolution slows down because there aren't any other species to mix genes with, and then there is the problem of having the entire ecology vulnerable to a single disease. But we're talking software and software development, not biology... However, I think the analogies work here. Memes (ideas, ways of thinking) replace genes, programmers and corporations replace the organisms, and money/time/mindshare replaces the resources that all are competing for. I think it's incredibly premature to think about integrating mono(.NET) memes into other projects until it's proven itself in the darwinian sense.
Here is an interesting article to you who think your .NET http://www.javalobby.org/clr.html
language will get the same level of support under
The CLR is based on the concepts of classes and single-dispatch, calling methods that "belong" to a class. Lisp's CLOS is built on multiple dispatch, and can cleanly support prototype object systems. It's hard to retrofit these capabilities onto a class and single-dispatch system, but it's easy to go the other way. Emulating multiple dispatch without the ability to re-compile on the fly leads to slow code.
And, socially, many Lispers see Java, .NET, etc. as
shallow attempts to mimic what they've had for over
a decade: A portable, reflective, dynamic environment.
Java and many of the .NET languages leave out key
portions of Lisp. Lisp allows programmers to
control how the code is
read,
translated, and then
compiled without leaving
the language. You can build infix Lisp
in Lisp, with all the tools of Lisp at your
disposal. Or you can eschew many of
the tools in Lisp, all from Lisp.
The page below has an interesting discussion of why the implementations of many languages on .NET will be just C# with a new "skin"
http://www.javalobby.org/clr.html
Of course, I haven't checked the facts, so it could just be FUD.
I was thinking about this the other day. They were showing some archive footage of Mr. G. at the XBox launch and he looked very old in his trendy XBox jacket- like some sad old woman wearing make-up and a short skirt.
I suddenly thought about what would happen if he just had a heart-attack tomorrow and died. God knows, his job must be pretty stressful, even if he doesn't read slashdot.
I realized I would miss him- at least as a concept. I mean I dislike a lot of things that MS has done, but in the end they are a company trying, like every other company, to make as much money as possible.
But think about it- no play is complete without its villian, and he does make life more interesting. I mean, how cool would slashdot be without anti-ms stories and postings, as well as anti-sun, anti-sony etc.?
Headlines:
* Gnome developers release new cool desktop.
* KDE developers in love fest with gnome developers.
* Everyone gets along splendidly and collaborates on new open-source software.
* We all love each other.
* Miguel and RMS have polite disagreement over whether to call it "free beer" or "free lager".
Etc.
So, I guess what I'm trying to say is that if Bill Gates died tomorrow I would say- "That's a shame- he seemed like an OK guy, really."
So go ahead, flame away.
(Hmm. Maybe you're not supposed to drink with this cough-medicine.)
graspee
This isn't like Samba, where the Samba guys are basically reverse engineering a proprietary Microsoft protocol (CIFS aside.. it was never really intended to document all of SMB).
With C# and the CLR, well, it's an ECMA standard. Go look it up. And the ECMA standards group has policies that deal with patents on their standards...
- Steve
A compiler for Itanium or P4 can directly take advantage of instruction-level parallelism and hyperthreading, while going through CLR or JVM precludes that. That's particularly important for functional programming languages because they make exploiting such parallelism much easier than object-oriented languages.
Purely functional langauges stateless work quite well under an object oriented frame work. Yes, I know objectes are supposed to have state. Object level states are handled very well in all modern purely functional langauges via monads. I think Haskell has transioned to COM programming very nicely.
.NET. They are not even adding support for the various open source technologies like CORBA. I expect that you will find open source operating systems to be a bit behind the times langauge wize in a few years.
As a side note, anyone notice how all the current langague research is going on under Windows with Microsoft grants? Currently, most of the projects simultaniously support Windows and Linux, but these projects are currently focusing a lot of attention of COM and
The Christian religion has been and still is the principal enemy of moral progress in the world. -- Bertrand Russell
I checked out both links and it seems like you know your stuff ;). Thus I have a question for you.
I have drifted more and more towards functional programming. In fact, even my C++ is starting to look more and more functional, with lots of small functions and the occasional recursion. The logical step for me is to try out some functional languages and see if I find anything I like. I did this and ML was the one I liked best (mainly for 2 things: efficient compilers and possibility for an imperative style when that is the best solution).
The questions: What are the differences between ocaml and SML/NJ? Are there other mature ML-dialects (preferably with compiler, debugger, profiler and perhaps a plugin for glade, etc)? I have tested ocaml on some smaller programs and is quite pleased with it. Is there any reason why I should consider SML instead?
Opinions stated are mine and do not reflect those of the Illuminati
You can almost count on Microsoft adding goodies, and Mono will always be catching up to be compatible with Microsoft.. unless... Why don't we (the open source community) BEAT Microsoft at it's own game? Once Mono is released, let's embrace it and extend it to where beautiful UI features and widgets will run under Linux but *not* under Windows. Certainly if enough open source developers start contributing, just by sheer numbers we'll pull far ahead of Microsoft. This is a much better path then trying to match MS's offering bug for bug.. The key to success is building a better mousetrap, not the same mousetrap for a lower cost. Brand loyalty matters...
Look at it this way: if .NET is all MS says it will be then they will be opening themselves up to more and more competition; they will be creating a freer market for code than exists today. Surely no one here is so stupid as to imagine that's what MS wants?
.NET will launch with as much support as the marketing department can get for it and then it will slowly morph.
Each year will see a new version with more API calls etc defined and, you know what? Just after that all the MS programs that have been written using the beta versions of those API's will come out, well in advance of even the poor dupes that fork out for MSDN.
Everyone apart from MS will be playing catch-up again.
How many fucking times do you have to be done over before you learn???
TWW
"Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
In the US (and in an internet perspective that's what counts) it has been proved that anything can be patented so don't hold your breath. OneClick shopping anyone?
When they have locked a minor detail which marketing departments view as "essential", be it a nice graphical widget or whatever, they will be recomending their respective managers to switch to the MS technology that supports it.
Nobody is going to force you to use it but if it is going to increase developers productivity then why not?
See above... Maybe small projects won't be forced, but in major companies it's not the programmer who decides and he seldom has much to say. And small projects is not what MS is conserned about. They want the big bucks.
btw... I'm saving my own comment.. ;-)
I have ported Prolog to the CLR. (A very naieve implementation, more a proof of concept). It was work done as part of my Microsoft student sponsorship dealie this summer.
It worked fine. Backtracking, lists, the lot. I implemented a marshaller to move data types from the CLR to Prolog, and extended Prolog with a couple of predicates to allow object instantiation from classes and method invocation. Syntax was a little ugly, but that can be fixed up. I think the semantics were fine.
So it can be done. Pretty easily, in fact.
Henry
i don't do sigs. oops.
well, it's a pretty safe bet that the .NET version of Visual Basic is going to generate code that makes calls to lots of Windows-specific, unpublished, and possibly patented API's.
"Unpublished" and "patented" are at a certain level mutually exclusive. if Microsoft wants to collect damages, Microsoft will have to put conspicuous patent notices on every single copy of Windows, or perhaps even require every developer that uses VB.NET to put patent notices on their software.
Will I retire or break 10K?
I agree that users of non-OO/imperative languages will be forced to accept a lower common denominator if they employ .Net framework classes, but I predict that the benefits will outweigh the loses. Most exotic language features go unused for good and bad reasons, and as processor speed increases and memory cheapens, framework portability and coder productivity will outstrip the benefits of relying on the exotic features.
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.
I agree with you on patents in .NET.
.NET with many of its key components patented.
.NET, in this alternate realm, Microsoft could successfully have been enforcing patent claims against open source technologies like SAMBA without fear of the DOJ boom coming down upon their actions. WINE would have been obliterated many years ago in a flurry of lawsuits. Tools that were even tangently related to any of MS patents could have been targeted.
But clearly the biggest mistake that Gates and his evil hearted minions made was to bring the eye of the government upon themselves before they had the key components of their next generation framework inside a patent protected harbor.
Consider this alternate reality: Microsoft doesn't blow its sham of a business model in a quest after meaningless web browser market share. It instead safely lies low preparing
And prior to
We should be pleased that Microsoft didn't have the intelligence and forebearance to pull something like this off. Open source wouldn't be nearly where it is today. As to whether they can turn the patent tables in their favor in the future, is yet to be seen.
Sadder than if YOU died!
This needs rephrasing: your obviously deficient teacher favoured recursion over iteration
Does CLR support continuations?
As long as the language is Turing-complete, it should be possible
.NET could work with it? So can someone get cracking with BrainF***) and Befunge 93?
So as long as its turing-complete,
you forgot AutoCAD/AutoLisp - one of the first embedded languages in a major package.
Too bad I can't anymore.
Hopefully .net will help.
I'll be able to write my programs using a mixture of stuff - Prolog for what it's good for, C++ (or C#) for what it's good for, Python for what it's good for. I'll be able to follow the program through in my debugger irrespective of what that part of the code is written in.
No more of that annoying glue code (or at least, not much...)
I'm looking forward to it.
If you want a high-performance functional programming language
Boy, and I thought "military intelligence" was the biggest oxymoron ever.
Freevo - Linux Multimedia Jukebox
Okay, I apoligize for an extra long post here, but I still see people mischaracterizing functional programming. So I'm going to take a few excerpts from "Why Functional Programming Matters" by John Hughes. It's a short paper, worth your time if you're new to the functional paradigm.
No Side Effects:
Functional programs contain no side-effects at all. A function call can have no effect other than to compute its result. This eliminates a major source of bugs, and also makes the order of execution irrelevant - since no side-effect can change the value of an expression, it can be evaluated at any time. This relieves the programmer of the burden of prescribing the flow of control. Since expressions can be evaluated at any time, one can freely replace variables by their values and vice versa - that is, programs are "referentially transparent". This freedom helps make functional programs more tractable mathematically than their conventional counterparts.
Higher Order Functions:
Functional languages allow functions which are indivisible in conventional programming languages to be expressed as a combi-nation of parts - a general higher order function and some particular specialising functions. Once defined, such higher order functions allow many operations to be programmed very easily. Whenever a new datatype is defined higher order functions should be written for processing it. This makes manipulating the datatype easy, and also localises knowledge about the details of its represen-tation. The best analogy with conventional programming is with extensible languages - it is as though the programming language can be extended with new control structures whenever desired.
Lazy Evaluation:
A complete functional program is just a function from its input to its output. If f and g are such programs, then (g . f ) is a program which, when applied to its input, computes g (f input). The program f computes its output which is used as the input to program g. This might be implemented conventionally by storing the output from f in a temporary file. The problem with this is that the temporary file might occupy so much memory that it is impractical to glue the programs together in this way. Functional languages provide a solution to this problem. The two programs f and g are run together in strict synchronisation. F is only started once g tries to read some input, and only runs for long enough to deliver the output g is trying to read. Then f is suspended and g is run until it tries to read another input. As an added bonus, if g terminates without reading all of f 's output then f is aborted. F can even be a non-terminating program, producing an infinite amount of output, since it will be terminated forcibly as soon as g is finished. This allows termination conditions to be separated from loop bodies - a powerful modularisation. Since this method of evaluation runs f as little as possible, it is called "lazy evaluation". It makes it practical to modularise a program as a generator which constructs a large number of possible answers, and a selector which chooses the appropriate one. While some other systems allow programs to be run together in this manner, only functional languages use lazy evaluation uniformly for every function call, allowing any part of a program to be modularised in this way. Lazy evaluation is perhaps the most powerful tool for modularisation in the functional programmer's repertoire.
Why you might care:
Modularity is the key to successful programming. Languages which aim to improve productivity must support modular programming well. But new scope rules and mechanisms for separate compilation are not enough - modularity means more than modules. Our ability to decompose a problem into parts depends directly on our ability to glue solutions together. To assist modular programming, a language must provide good glue. Functional programming languages provide two new kinds of glue - higher-order functions and lazy evaluation. Using these glues one can modularise programs in new and exciting ways... Smaller and more general modules can be re-used more widely, easing subsequent programming. This explains why functional programs are so much smaller and easier to write than conventional ones. It also provides a target for functional programmers to aim at. If any part of a program is messy or complicated, the programmer should attempt to modularise it and to generalise the parts. He should expect to use higher-order functions and lazy evaluation as his tools for doing this.
Could it be? Are there some positive posts regarding a Microsoft technology on Slashdot?
.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.
I've just started to scratch the surface of what
And that simply emphasizes (yet again) that the problem with most programming languages/IDEs isn't the languages or the tools; it's usually the culture of the users of that language or tool.
I could go on and on, but I will just contain the rant.
Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
Mainly I am worried that Scheme continuations didn't make it into .NET. Does anyone know more about this?
Prolog is NOT functional language. Prolog is logical programming language. LIST is functional programming language.
.NET.
Why on the earth people keep confusing PROLOG and LISP?! They are so different.
Now on the subject: Prolog is not generic programming language which could be fit into generic-purpose VM. It requires quite specific algorightms implemented in VM (Unification, Resolution) which are of little interest to other languages. Yes, they could be put into VM, but this is like putting regex library there.
Lisp is different. There was talks about putting it to Java VM, so I guess it will be possible to put it into the
OCaml and SML are different languages, OCaml is the one implementation of OCaml (...) and SML/NJ is one of many implementations of SML. Some other SML implementations worth checking out are MLton, Poly/ML, Moscow ML, and (soon) TILT/ML.
I don't know of any other mature ML dialects (though there are plenty of spin-off languages).
Personally, I like SML the best, but here's the rundown.
Here's some reasons to prefer SML:
- Many more compilers on (I believe) more architectures. There are something like 10 SML compilers vs 1 for caml.
- A more stable, thoroughly designed and defined language. Caml's is defined by the implementation and docs, and changes somewhat frequently (though the core language usually stays the same).
- A fancier module system
- More aesthetic, I think.
Here's some reasons to prefer O'Caml:
- Faster? Their native code compiler is awfully good. I think mlton (for SML) can stand up to it pretty well, but caml's is probably faster for most stuff.
- More hacker-oriented; it has stuff that's pretty difficult to justify from a theoretical or aesthetic perspective, but which is useful in practice. One example is a C-style "printf" keyword.
- One compiler and one platform means a rallying point for tools and libraries, so I think they are somewhat richer in this area.
Either way, you'll be able to do almost anything you want. All SML compilers I know of have C library interfaces, so you can pretty easily hook into libraries when you write your programs. I think it's mostly a taste issue..
Am I the only one who has to reload each page of this thread three times to avoid the "Cannot connect to server" little pagey?
Can slashdot be slashdotted?
Freedom is the freedom to say 2+2=4, everything else follows...
The Java Pet Store, Sun's J2EE best practices blueprint application, was rewritten in C#. It took 1/4 the code and performs anywhere from 15 to 28 times faster than J2EE. Check it out here. Debate on how it was done can be found here.
Dimitre Novatchev has published a proof for functional programming called "The Functional Programming Language XSLT - A proof through examples"
Until now it was believed that although XSLT is based on functional programming ideas, it is not as yet a full functional programming language, as it lacks the ability to treat functions as a first-class data type. Based on numerous concrete XSLT implementations of some of the major functional programming design patterns, including some of the most generic list-processing and tree-processing functions, this article provides ample proof that XSLT is in fact a full-pledged functional programming language. The presented code forms the base of a first XSLT functional programming library. It is emphasized that a decision to include higher-order functions support in XPath 2.0 will make functional programming in XSLT even more straightforward, natural and convenient.
The interesting question here is SHOULD XSLT be used in this way?
Cite, please?
I'd be very interested to know what technology is letting you beat Visual C++, since that's what we develop with at work. (But please tell me you're not comparing brand new Java 1.4 systems to the years-old Visual C++ 6 and not the just released Visual C++ .NET.)
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
It could be true -- but I'm not betting on it.
I think you'll find
VB
C
Java
In that order for the enterprise counted in # of developers employed... although powerbuilder might be above Java.
Then again -- i have no numbers either and would be interested in seeing some.
[In practice, Turing completeness] means the language (or system) can compute the same functions as can a Turing machine, with the understanding there are finite resources.
OK. "Turing-complete with storage restricted to 128 MB" I can handle. I first began to point this out in a discussion on one of the Transmeta articles to somebody who argued that a Crusoe processor can in theory recursively emulate itself because it's "Turing complete." I responded that for each layer of emulation, you'd need additional storage (at least 1 KB for registers and 16 MB for the decode cache). Metacircularity for a system (often talked about in Lisp books) requires at least a constant amount of additional storage for each virtual machine, and you eat this overhead when you run a program inside JVM, CLR, VMware, Bochs, plex86, anything.
Will I retire or break 10K?
Lisp does not favor recursion over iteration, and Lispers do not think that use of variables is a bad habit. You're thinking of Scheme, which is a different language entirely. (But even Schemers don't think variables are bad!) For some information on software written in Lisp, see www.lisp.org and Franz success stories.
Isn't this the definition of Embrace and Extend?
.NET becomes the standard on both Linux and Win32, they will have complete control over us.
.NET CLI system, and MS changes X that we now rely on, we are sunk.
MS is embracing the whole Java run-anywhere thing, and now they are extending it to go faster...
This technique has been used to kill other companies and technologies before, and once
Perhaps we should generate our own technologies/work on older, portable standards that aren't currently controlled by MS?
Sure, Linux was built by copying other technologies, but the reason Linux is so successful is that it is not _controlled_ by any company. EG: If SUN changed the format of the ls command, we would not care. If Linux apps are ported to the new
Surely this is part of the master plan to rid the world of Linux?
Just one more...
On a creaky 500MHz Celeron, 184MB RAM...
Java 1.3: 185s (using only Sun JDK).
C#: 116s.
Java 1.3 108s (compiled to EXE with JET 2.1)