14 ms·
Miranda released as free software
- kick 7y agoYou've at least heard of (if not used) a programming language heavily inspired by Miranda: Haskell. A lot of things about Miranda were really interesting; it reflects modern languages in some ways, but looks completely foreign in other ways. Like Haskell, whitespace was significant; unlike Haskell, it was fast. Really fast. It was one of the pioneering purely-functional languages, but seems to have been mostly forgotten. That's unfortunate, because in many ways it still is superior to its successors. Their fault for keeping it proprietary for so long, really.
- msie 7y agoThe language was such a pleasure to use in university in the early 90’s. Those were the days where you paid for compilers. My prof was grumbling about the licensing fees for Miranda though.
- kick 7y agoYeah, it was a bit ridiculous. Incredibly good software compared to what we've got now, though.
- agumonkey 7y agohow come it was so much faster ? smaller semantics allowing for more optimizations ? or some obscure reason ?
- kick 7y agoShort: Haskell made a bunch of poor design decisions that they've since doubled down on, the fastest implementation isn't very good, the art of writing compilers and interpreters has effectively been lost, and Miranda was written by and designed by professionals.
- jolux 7y ago"the art of writing compilers and interpreters has effectively been lost" I'm curious, how does that happen? Were the techniques used in compilers and interpreters of yore never recorded for posterity in academic papers or technical documentation?
- kick 7y agoSpent a good while thinking on your question: The best stuff was all proprietary for decades. Even now, we only got Miranda's source code weeks ago. Miranda was written in the 1980s! It's the same for a lot of languages. Nial's the example I usually bring up for one that was freed far too late. People with the domain knowledge that would have helped deal with the complexity of modern systems are all either retired, have ditched PL-design, or have died. Turbo Pascal, too, although that one's kind of strange because the author of it later went on to do a complete 180° turn while still working in PL design and implementation (plus it was never freed). Ken Thompson's cc suite for Plan 9 was behind a million-dollar license fee until a decade ago, and it wasn't even for any modern CPUs. He once quit the industry to become a flight instructor; he's at Google, but he's retired now. The best advice is "Stay small!" which most Free Software compilers seem to be violently against. It's not their fault, though: it's hard not to take new code when it's offered to you! We'll probably never see the source code behind any version of the k interpreter by Arthur Whitney, and trying to get an interview with him is like going on a snipe hunt, so good luck figuring out anything about his approach besides "Small!" It doesn't help that Kx sues the hell out of anyone who's actually seen the k source and tries implementing anything remotely like it that's not a toy. Every modern compiler is for multiple architectures in convoluted ways. This is generally a terrible idea, especially with how divergent they're getting in the times we're in, even between chips that have the same instruction set. Intel x86_64 processors aggressively speculate almost as intensely as Transmeta did back in the day, but we're still treating them and AMD chips more or less the same, and we're using the same compilers that we're using on that instruction set for RISC-V and for ARM and for Itanium and for obscure 16-bit CPUs and so on. Portable compilers aren't bad in principle, but when you look at pcc compared to GCC you'll see exactly where we went wrong: pcc wasn't very optimized, it was simple, and it was understandable. Great for bootstrapping. Not great for getting the most out of your CPU. Having portable compilers that try to heavily optimize is a mistake. No one seems to know what a CPU cache is! And how many compilers do you know that compile to C, or to LLVM bytecode or similar? It's insane: nobody should be doing that! That approach doesn't make much sense! And the only argument any of these people can make is "But our language is too big for it to be practical to write something unique for each architecture! Piggybacking makes it way quicker!" No one seems to realize that their languages are getting too large. They aren't even getting too large in a graceful way: Common Lisp is probably the biggest language there is, but it's extremely portable, and is easy to write an interpreter for. Things got complicated really fast, and domain knowledge was sort of lost in the waves of proprietary compilers as they were destroyed by GCC. I appreciate that free software "won" to some extent, but if it hadn't have won as fast, we might have had some knowledge transfer happen that was actually useful. Walter Bright isn't doing magic, but he and the people he work with seem to be some of the only people in Free Software who are making a compiler that's fast and good in the x86_64 world.
- asdkjh345 7y agoIt isn't, it is much slower. Download them both and try a few tests for yourself, GHC produces much faster binaries.
- bakul 7y agoI learned about Miranda from the appendix of "The Implementation of Functional Programming Languages" 1987 book by Simon Peyton Jones (IIRC one can find a PDF copy online). I liked it a lot though I had no access to its implementation. Glad to know it is now available. Its implementation is small by today's standards!
- soegaard 7y agoDitto!
- voldacar 7y agoAre there any more modern functional languages that are as fast or faster?
- kick 7y agok, J & APL, in roughly that order.
- voldacar 7y agoAPL is cheating since all the magic happens in highly pipelined SIMD-heavy loops :p but if it's really true that other than array languages, no modern FP language can outperform Miranda then that's really depressing. I was under the impression that GHC attempted to generate decently good code, maybe it's all the little allocations that slow Haskell down or something like that.
- kick 7y agoAPL isn't cheating because of that, it's cheating because it's small enough to fit in your CPU cache! I'm sure something else can beat Miranda, I'm just unsure of what. I don't really care for the FP paradigm outside of arrays and Lisp, though, so I'll be the first to admit that I haven't spent days looking; just a few hours here and there. Oh, actually: Stalin probably does. It's an R4RS compiler. Good luck getting it to compile, though. It took me a few hours and a lot of code changes to get it to compile half a decade ago (I wanted to compare the one I was writing, which was a lot worse, naturally, but much easier to compile). The compiler itself is slow as a tortoise, but it generates really wonderful code. It's probably rotted a bit now, though.
- mlochbaum 7y agoNo, it's the SIMD loop thing. The claim that k runs quickly because its functions fit in the CPU cache is, as far as I can tell, an off-hand comment that Arthur Whitney made once which has been repeated far more than it deserves. It's false—instruction cache behavior doesn't contribute significantly to k's advantage over other languages—for a few reasons: inner loops in array languages are 3–5 orders of magnitude smaller than the CPU cache, the loops that compiled languages produce also fit in cache, and instruction caching doesn't matter all that much for performance anyway. Despite spending plenty of time looking for it, I've never been able to measure an impact of code size on performance. Even data caching doesn't have that much of an effect: current versions of Dyalog APL almost always allocate new arrays from uncached memory (this is mostly fixed in the next version), and it's still one of the fastest array languages around. Unless you're using SIMD, code with linear access patterns can't even keep up with main memory, and the cache has no effect. Why is using SIMD cheating? SIMD loops are the only way to get the full performance out of a CPU, and fast compilers do try to produce them. If it turns out that array-based interpreters are a better way to convert programmer intentions to SIMD loops than scalar compilers (and it certainly seems that way) then the array languages are legitimately faster. I suppose SIMD is considered "non-portable" because you can't use it from C, but that's an artificial restriction coming from historical programming language design decisions. The most important vector instructions are the same in any modern vector ISA. How is using standard CPU features cheating? They're not even that much newer than double-precision float support. (I'm an implementor for Dyalog APL.)
- rixed 7y agoDo you mean that the compiler was fast or that the generated programs were fast? Do we have a competitor for Clean?
- wk_end 7y agoYou've made several comments here suggesting that GHC - pretty widely considered an extremely powerful compiler - is inferior to what Miranda offers. Can you substantiate your claim that Miranda is faster than Haskell/GHC? FWIW, I just tried doing a very quick dumb benchmark - the classic functional pseudo-quicksort. GHC spit out a binary that can sort 10,000,000 numbers in a few seconds on my laptop. Miranda (after cranking up the heap size a couple orders of magnitude) took noticeably more time to sort only 1,000,000.
- kick 7y agoI promise I'll respond to this in the morning, I'm very tired right now and don't want to give a good and reasonable question an answer that hasn't been thought out well, especially given that my responses have been getting less detailed and concise as I've gotten more tired.
- fanf2 7y agoOh wow, Miranda is still using an SK combinator reduction evaluator dating from 1986, in K&R C. It isn't even using supercombinators, which I read about in https://www.microsoft.com/en-us/research/publication/the-implementation-of-functional-programming-languages/ https://www.microsoft.com/en-us/research/publication/the-imp... Combinators are fun, but not very fast :-) https://dl.acm.org/doi/10.1145/800087.802798 https://dl.acm.org/doi/10.1145/800087.802798 http://ioccc.org/years.html#1998_fanf http://ioccc.org/years.html#1998_fanf
- ncmncm 7y agoJust for comparison, C++ running the shortest, simplest possible quicksort does 100,000,000 32-bit ints in 8s. Three more lines, and it's 3.4s. That's 1.3ns each time it looks at an element. So when you are already giving up an order of magnitude or two, another doesn't matter so much. It pays then to steer the conversation toward other merits.
- yatac42 7y ago> C++ and the shortest, simplest possible quicksort wk_end was talking about "functional pseudo-quicksort" on immutable linked lists. You're presumably talking about a proper quicksort on mutable arrays. That's comparing apples to oranges. And even if you weren't, how is that an argument? Person A says "X is faster than Y", then person B says "Actually I just ran X and it took 10x longer than Y" and then you say "Well Z, which isn't even part of this discussion, is 1000x faster than both X and Y, so your argument is invalid". How does that follow?
- _bxg1 7y agoUnder "Why the name Miranda?": > Because it is a proper name, not an acronym, only the first letter of Miranda is capitalised. It took me a second to realize that most language names of this era were in fact all-caps acronyms
- deleted 7y ago[deleted]
- froh 7y agoI kindly beg to differ for the 1980s: https://en.m.wikipedia.org/wiki/Timeline_of_programming_languages https://en.m.wikipedia.org/wiki/Timeline_of_programming_lang... The all-caps acronyms were the 1960s and before
- buckminster 7y agoThis could do with a 2010 label. Back in the day, Orwell was a free Miranda clone. So I used that.
- kryptiskt 7y agoThe page has been updated recently, the 64-bit version was added this year. So it's actually the date on the page that is wrong.
- kick 7y agoYeah, the date on the page is wrong. See: https://web.archive.org/web/20181015090301/http://miranda.org.uk/downloads https://web.archive.org/web/20181015090301/http://miranda.or... It was still proprietary as of 2018/most of 2019, got a source release in the form of a 32-bit version around December, and then a 64-bit version released around a month ago, from what I can tell. I completely missed this occurring until a friend pointed it out, but I'm so happy it did.
- slim 7y agothat date seems to be the date "sitemeter" passed away
- jonstewart 7y agoI learned a bit of Miranda in my programming languages class at the University of Iowa, back in... 1999? 2000?, under Prof. Arthur Fleck. Just that little bit of Miranda really prepared me for generic and functional idioms in C++.
- hyper_reality 7y agoMiranda is still taught as a language for University College London's Functional Programming course: https://www.ucl.ac.uk/module-catalogue/modules/functional-programming/COMP0020 https://www.ucl.ac.uk/module-catalogue/modules/functional-pr... Students grumble at having to learn such an esoteric language; the justification of the professor is that it's simpler and more focussed than Haskell and so better for teaching functional concepts. This may be true but perhaps he's just been teaching the same material for decades and doesn't want to update it.
- kick 7y agoHe's right! Haskell is still stuck with most of the wrong decisions they made in '88, and it was intended as a (clunkier) Miranda clone, anyway.
- saagarjha 7y ago> Haskell is still stuck with most of the wrong decisions they made in '88 Which ones?
- brmgb 7y agoWhile I don't agree with the general snarkiness towards Haskell of the commenter you are replying to, being lazy by default could be seen as Haskell original mistake. It was interesting from a research point of view though.
- greydius 7y agoMiranda is also lazy, so that can't be it.
- ferzul 7y agoit's hard to call the sine qua non of a language a bad design decision. if it were, the language would be dead. haskell survives because it's a lazy purely functional language with some industry support. bad design decisions have to be something apart from that.
- mark_l_watson 7y agoI read the overview, cool language, very cool to see it open sourced, and just looking at the code it is clear how much it inspired Haskell. I started hacking (a lot!) this week on an experimental project in Swift. Swift is similar to Haskell and Miranda in supporting functional programming. I like Haskell’s syntax and in general REPL based Haskell development, so at first Swift’s syntax bugged me. However, when I set my project up with Playgrounds for developing bits of low level functionality in what is effectively a REPL environment, and spent a day with XCode, I now think Swift is a worthy substitute for Haskell for some projects (i.e., when targeting macOS and/or iOS).
- LessDmesg 7y agoSwift is not similar to Haskell and Miranda. It's an imperative refcounted manually managed language with strict evaluation, while Haskell and Miranda are GCed languages with lazy evaluation and immutability. It's hard to find languages more different, really.
- mark_l_watson 7y agoYou are right of course about the non-lazy part and like Scala, it is easy enough to use mutable data, although not good style.
- lucidone 7y agoI learned a bit of Miranda and Oberon for a programming languages course back in school, prior to knowing what Haskell was (or even functional programming proper). Can anyone speak to its capability for a fun hobby project (web dev, or a CLI)? I liked the language.
- virtualritz 7y agoWhen I started studying CS in Hamburg, Germany, in the early 90's, they taught us Miranda to have everyone on the same level. Which was not such a bad idea: I had three years of C & five of C++ under my belt already at the time but never touched a functional programming language. Very few co-students had worked with Lisp and they did have an advantage. But they still had to new learn a new language. Trivia 1: I was going out with a German-Iranian girl who's name was Miranda, at the same time. Trivia 2: As I was also studying graphics design with an emphasis on typography then I made her a t-shirt for her b-day that used the 'Mirinda'[1] logo but turned it into 'Miranda'. She never wore it which hurt me a bit at the time. Maybe I should dig that out and donate it as the logo for that language since theirs is an absolute eyesaw? :] [1] Mirinda is a carbonated soft drink (https://en.wikipedia.org/wiki/Mirinda https://en.wikipedia.org/wiki/Mirinda) The logo in the 90's looked different -- like this: http://tiny.cc/24rnkz http://tiny.cc/24rnkz
- nevster 7y agoLikewise, when I started my CS degree at UNSW in 1989 they taught us Miranda before moving on to Modula-2. Fresh out of high-school and our first programming course, the lecturer said something like "Ok all you smartarses who have mucked around in BASIC and think you can program, we're going to teach you Miranda!"
- jimmux 7y agoANU in maybe 2003, we had a single tutorial in Miranda to demonstrate the functional paradigm. It wasn't enough to appreciate the value of functional programming, but I guess they still had licenses and wanted to use them for something.
- chrisweekly 7y agoHeh, cool associations, thanks for sharing. nit: "eyesaw" -> "eyesore" (unless "eyesaw" was deliberate -- pretty evocative!)
- deleted 7y ago[deleted]
- jungletime 7y agoBack in the 90s I remember taking a course that used Simple ML. I was pretty amazed by it's elegant syntax, and If I remember it correctly, it was either based on, or related to Miranda. I haven't really used a functional language since university. But would love to try one again. Whats worth checking out? I know nothing. Anything I can use to make a website or an interesting project within a week of learning.
- pintxo 7y agoJavaScript has some FP parts, and is kind of the goto language for websites. But is not strictly functional.
- erk__ 7y agoIf you want something functional that compiles to JavaScript you can for f# use Fabel [0] and there is a ocaml-like language called reasonML [1] that also does it. [0]: https://fable.io/ https://fable.io/ [1]: https://reasonml.github.io/ https://reasonml.github.io/
- beagle3 7y agoReason{ML,} is just a new syntax for OCaml, still perfectly round trip translatable I believe (though that's something I expect to diverge over the years). You can use js_of_ocaml or BuckleScript to translate either OCaml or ReasonML written code to JavaScript.
- Multicomp 7y agoF# is an ml inspired language running on the .net clr. Use the SAFE template if you are interested in doing web development with this language.
- kristianp 7y agoThis? What does safe stand for? https://safe-stack.github.io https://safe-stack.github.io
- chubot 7y agoCool, looks like a pretty browsable/readable code. There's some apparently duplicate code in '/new/' I omitted. $ ls *.[chy] | grep -v y.tab | xargs wc -l |sort -n 3 version.c 9 utf8.h 21 fdate.c 30 lex.h 62 big.h 88 utf8.c 143 combs.h 144 cmbnms.c 295 just.c 320 menudriver.c 350 data.h 656 big.c 1000 trans.c 1220 lex.c 1315 data.c 1674 types.c 1689 rules.y 2241 steer.c 2394 reduce.c 13654 total
- LessDmesg 7y agoHere's an idea I have: never close-source any programming language, make 'em free and open from day zero. Languages are not products, but infrastructure, like roads. They benefit and grow from the number of users, not from paywalls. Closed languages tend to fade into obscurity. That's why everyone knows Haskell and nobody knows Miranda, everyone knows Java and nobody Eiffel. I laughed when I read that the author of Shen/Qi changed the license from a commercial to a slightly more permissive one, when no one cares about his little language. Such conceit kills languages. Microsoft has realized this only recently with .NET, when the JVM was already miles ahead. Which is sad because the CLR is so much smarter than JVM.
- kick 7y agoHaskell was written as academia's response to Miranda's licensing fees. Were Miranda freeware (but not source available or Free Software), it probably would still be well-known. It's still taught in many universities. I certainly agree that most languages should be libre, but clearly it's not necessary for success. k has brought billions of dollars of profit, but is the most proprietary of all languages. C# developers are the most common in the world, for some reason. VBA is popular. Excel has the most programmers. Mathematica makes millions. Matlab makes millions.
- 9q9 7y agoMiranda's cost was a big problem, but not the only one. The other core issue that lead to the creation of Haskell was Miranda's license that essentially prohibited using it as a tool for programming language research. For good reason, Turner (Miranda's creator) wanted to avoid the fragmentation of Miranda into different dialects. From [1]: > [T]he easiest way to move forward was to begin with an existing language, and evolve it in whatever direction suited us. Of all the lazy languages under development, David Turner’s Miranda was by far the most mature. It was pure, well designed, fulfilled many of our goals, had a robust implementation as a product of Turner’s company, Research Software Ltd, and was running at 120 sites. Turner was not present at the meeting, so we concluded that the first action item of the committee would be to ask Turner if he would allow us to adopt Miranda as the starting point for our new language. After a brief and cordial interchange, Turner declined. His goals were different from ours. We wanted a language that could be used, among other purposes, for research into language features; in particular, we sought the freedom for anyone to extend or modify the language, and to build and distribute an implementation. Turner, by contrast, was strongly committed to maintaining a single language standard, with complete portability of programs within the Miranda community. He did not want there to be multiple dialects of Miranda in circulation and asked that we make our new language sufficiently distinct from Miranda that the two would not be confused. Turner also declined an invitation to join the new design committee [...] Haskell owes a considerable debt to Miranda, both for general inspiration and specific language elements that we freely adopted where they fitted into our emerging design. [1] P. Hudak, J. Hughes, S. Peyton Jones, P. Wadler, A History of Haskell: Being Lazy With Class. https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/history.pdf https://www.microsoft.com/en-us/research/wp-content/uploads/...
- tus88 7y agoFirst language I learned at Uni, right before C!
- mleonard 7y agoAnyone know of any available-online courses that teach functional programming using Miranda?
- lngnmn1 7y agoWonderful. Along with original MIT Scheme it is a great teaching language and an example of clarity, brevity and conciseness which comes from a rigorously trained mind. Beautiful piece of software.
- z3t4 7y agoIf you would make a new language today you would design for readability above all else. Because modern software are huge, while programs back in the day was small.
- beagle3 7y agoReadability is entirely and extremely subjective. I don't find Japanese readable, but that's because I never bothered to put the time in to learn it. I find TeX and LaTeX readable, though. Readability becomes slightly more objective, but not much more so, when you have a well defined and sufficiently homogenous target audience. If you make a new language today, you should figure out who it's for (probably yourself and a couple of other people), and design it accordingly. As was always the case.
- otabdeveloper2 7y ago> If you would make a new language today you would design for readability above all else. So, basically, COBOL?
- rwmj 7y agoThis is really big news, albeit about 27 years too late to matter. Miranda is the elegant sister of Haskell, a really beautiful pure functional language. When I was a student I wrote a Perl(!) script which translated Miranda source to Haskell so I could test my classwork exercises at home on my Linux/386 machine without having to go into the labs (no internet in those days!)
- voidhorse 7y agoI've been playing with Miranda a little bit since seeing this yesterday, and man, I gotta say, the quality of the REPL environment and documentation is amazing. Everything is laid out plainly, and you can learn how to work with the language in a matter of minutes. Even the readme was one of the best I've ever encountered. It makes no undue assumptions and leaves no work up to the reader. It even notes that one may need to make certain edits to the Makefile on certain systems and, if needed, how and where one should do so (I've had to make several other programs in the past that require more tweaking and don't document the possibility or guide the user at all). The language itself seems slim and elegant so far, but, if nothing else, I'm amazed at the level of quality of the compiler documentation, the manageable size of the source, and the REPL's design--it encourages you to write entire programs from the REPL, by allowing you to direct output to a file and to invoke an editor to modify the current scripts loaded into the environment--all this without the need for special plugins on the editor side; instead of having to invoke the REPL from your editor, your REPL invokes your editor--honestly it seems like the right relationship and now I'm fairly confused why other REPL focused languages don't commonly support this. Everything comes bundled too--you don't need to go through some gitbook based tutorial docs in your browser to get up to speed--it's all available right from the system itself. A lot of contemporary programming languages I've used don't have nearly as good of an onboarding experience. It makes me wonder to what extent this is just a rare case of quality work by great programmers and to what extent its symptomatic of what one can deliver with licensing and funding, as opposed to purely open-source contributions largely driven by community interest.
- Bytenik 7y agoHmmm...I'm wondering if there's something wrong with my build (Mac OS X) or if I'm just "using it wrong" because the REPL (not the language) seems pretty unusable to me. The up and down arrows just show escape sequences instead of going to previous/next history. Entering `foo = 123` gives the error `UNDEFINED NAME - foo`. Entering `exp foo = 123` gives the same error. Entering the same expression on a line in a file works though (`/f test.m`). Am I doing it wrong?
- sedachv 7y ago> instead of having to invoke the REPL from your editor, your REPL invokes your editor--honestly it seems like the right relationship and now I'm fairly confused why other REPL focused languages don't commonly support this. That is originally how REPLs worked in Lisp and APL systems in the 1960s. In BBN Lisp/Interlisp (see http://www.softwarepreservation.org/projects/LISP/bbnlisp/W-21_LISP_Editor_Apr67.pdf http://www.softwarepreservation.org/projects/LISP/bbnlisp/W-...) and APL\360 you called the built-in editor from the REPL. There were not really any stand-alone interactive editor programs around back then, and the operating systems BBN Lisp and APL ran on mostly did not properly support running multiple processes to run editors anyway. Maclisp on ITS had job control, and you could call external editors: http://www.maclisp.info/pitmanual/edit.html http://www.maclisp.info/pitmanual/edit.html Doing it the other way around is better for projects written in multiple languages, dealing with multiple implementations, running processes on remote systems, and IDE features.
- kick 7y agoI think I've responded to everything in this thread. If I've missed something, please point it out. I'll look through again later: I spent like five hours straight replying to this thread today, so I'm kind of tired of talking.