Live data from Hacker News

Miranda released as free software

cs.kent.ac.uk

51–60 of 126 posts

Re: Miranda released as free software

#51

Here'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 S…

Haskell 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.

Re: Miranda released as free software

#52
post #14

Earlier quoted context omitted.

Short: 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.

Would you mind elaborating on these points?

I have for most of it elsewhere in this thread (I think you can find my answers by checking my /comments), but for what I didn't get to, I'll get to tomorrow. My responses are getting worse as I tire.

Re: Miranda released as free software

#53
post #47
post #2

You'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 forgot…

You'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…

I 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.

Re: Miranda released as free software

#54
post #49
post #46

Earlier quoted context omitted.

Why is compiling to LLVM bytecode insane? Compiling to bytecode and then working with a simpler language has worked for decades since the introduction of BCPL. It's also the approach used by Open64, where you compile to WHIRL which is then optimised with successive passes until you eventually output whatever the architecture can run.

Good question! BCPL's O-Code is far different from LLVM bytecode. O-Code was little more than a virtual stack machine. Very similar to Forth, though slightly more complicated. I could be wrong, but isn't Open64 more or less dead? The only thing I can think of that actually uses it (CUDA) isn't best-in-class.

So u say, LLVM or whatever is insane because it's large. so what do u think about QBE[0] ?

0 : https://c9x.me/compile/

Re: Miranda released as free software

#56
post #38

Earlier quoted context omitted.

Are there any more modern functional languages that are as fast or faster?

k, J & APL, in roughly that order.

You can write code in a functional programming style in k/j/apl, the same as in Scheme etc., but they are imperative languages.

Re: Miranda released as free software

#57
post #49
post #46

Earlier quoted context omitted.

Why is compiling to LLVM bytecode insane? Compiling to bytecode and then working with a simpler language has worked for decades since the introduction of BCPL. It's also the approach used by Open64, where you compile to WHIRL which is then optimised with successive passes until you eventually output whatever the architecture can run.

Good question! BCPL's O-Code is far different from LLVM bytecode. O-Code was little more than a virtual stack machine. Very similar to Forth, though slightly more complicated. I could be wrong, but isn't Open64 more or less dead? The only thing I can think of that actually uses it (CUDA) isn't best-in-class.

I believe you're correct about Open64, but it was an interesting examples of a compiler when I was researching them last, particularly its usage of WHIRL [1]. It's a similar approach as used by GCC and LLVM with their front, middle and back-end approach, although I can't quite remember if it pioneered that approach or not.

[1] https://www.mcs.anl.gov/OpenAD/open64A.pdf

Re: Miranda released as free software

#58
post #20

Back 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.

JavaScript has some FP parts, and is kind of the goto language for websites. But is not strictly functional.

If 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/ [1]: https://reasonml.github.io/

Re: Miranda released as free software

#59
post #38

Earlier quoted context omitted.

Are there any more modern functional languages that are as fast or faster?

k, J & APL, in roughly that order.

As far as I know, all three of those languages are interpreted. They might be good at slinging together predefined operations with fast implementations written in another language (C)… as long as you’re operating in parallel on large arrays, so that you spend more time inside the C functions than actually interpreting. But if you need to write your own operations or just do anything that’s isn’t massively parallel, none of those languages even compete. For example, you couldn’t write a performant compiler in them. In contrast, languages like Haskell and OCaml have compilers that generate native code – maybe not C-level native code, but still an order of magnitude faster than an interpreter.

Edit: For that matter, from quickly browsing the source code, it looks like Miranda is interpreted as well. So it’s absurd to say it’s faster than Haskell.

Re: Miranda released as free software

#60
post #44

Earlier quoted context omitted.

APL 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.

APL 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…

No, 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.)

Post reply on HN