4 ms·
> you've re-implemented big parts of Rust or Haskell Maybe. Or maybe all I had to do to turn CL into Haskell is implement the Hindley-Milner algorithm. I did
by lisper 5y ago
> you've re-implemented big parts of Rust or Haskell
Maybe. Or maybe all I had to do to turn CL into Haskell is implement the Hindley-Milner algorithm. I didn't have to write a parser or a compiler because I can just re-use those from CL.
- joshuamorton 5y agoRust didn't have to do those things either, parser generators and LLVM meant that much of the work was done for them. So they spent their time on borrow checking. Now they are reimplementing some of those things for performance reasons, but you're going to have a hard time convincing anyone that a lisp-based rust you wrote is going to be more performance than the one that exists today, so they'd need to make those optimizations anyway.
- steveklabnik 5y agoRust does not use (and I’m pretty sure “has never used”) a parser generator.
- lisper 5y agoAnd even if it does, that misses the point. You still have to put in effort to design and write the grammar. If you embed a DSL with Rust's semantics within Lisp you don't have to do that. You just use S-expressions and use the Lisp reader to parse them.
- joshuamorton 5y agoYou're assuming that creating a fully featured dsl that is ergonomic enough will be vastly simpler. "Just" is doing a lot of work, and hiding complexity, as it often does.
- lisper 5y agoI'm not assuming it, I have actual first hand experience, and a lot of data points from other people's efforts. You are absolutely right that I'm squeezing a lot of content into the word "just". But I'm not doing it in a vacuum or out of ignorance.
- joshuamorton 5y ago> If a tenth of the effort that has gone into implementing Haskell had instead gone into implementing a Haskell-equivalent embedded in CL, that effort would plausibly be competitive with actual Haskell if not superior. It's such a wildly ridiculous claim though. It implies either 1. that the syntax of Haskell is the majority of the work, such that using a dsl would remove 90% of the effort. 2. Somehow a dsl for Haskell embedded in a lisp would be more efficient to work in, so much so that development would be an order of magnitude faster. 1 is absolute nonsense. 2 might be true in a sense. I doubt it, but even if it were, such a language would no longer be Haskell, so you'd lose out on the value you gain from it's syntax. The same is true for rust. S-expressions are nice, but they aren't always the best way of structuring things, and if you're going to forego them to better embed another language, why constrain yourself to the lisp runtime? The more I look at this, the less sense it makes.
- AnimalMuppet 5y agoSo, where are these languages? You can create a DSL for a team working on a specific problem. Lisp is good at that. What I have not seen is a DSL that anyone else wants to use. Someone builds a DSL, a small team uses it. It just has to meet the needs of that team. It doesn't have to be bulletproof or elegant. It can have all kinds of rough corners. It can take undocumented tribal knowledge to know how to use it. The comparison to Rust is therefore almost completely misleading. It's like comparing Linux in 1992 to a commercial Linux distribution today.
- lisper 5y agoYes, that is a totally fair point. But Linux is where it is today because some people in 1992 looked at Linux in the state it was in at the time and decided that it had potential. If that hadn't happened, no one outside of a small group of hackers would ever have heard of Linux. The idea that embedding languages in CL is a bad idea is likewise a self-fulfilling prophecy.
- bitmapper 5y agoI used to use CL quite a bit, but have since abandoned it for Haskell, so I'm a bit biased. There's a number of issues with that: - I'd be missing all the optimizations that can be performed due to purity. - There's more to Haskell's type system than just vanilla Hindley-Milner, and the implementation of it isn't particularly trivial. https://github.com/stylewarning/coalton https://github.com/stylewarning/coalton is the closest thing and it's still missing a large amount of the type system. - Doing the implementation would be a significant amount of work to get it to integrate well with the language, and it would be a layer tightly glued on top instead of integrated with the language. I've seen many good DSLs embedded in lisp, but a type system is hard to embed in any language because it changes fundamental semantics of the language. Typed Racket is a massive project and it's lacking things like ADTs. - A major part of Haskell is the standard library, a good chunk of the semantics of Haskell people use on a day to day basis, like monads and etc, are a part of the standard library.
- lisper 5y ago> I'd be missing all the optimizations that can be performed due to purity. What I'm advocating here is not retrofitting Lisp but embedding DSLs within Lisp. In a DSL you have complete control over the semantics, and so you can do all the optimizations that Haskell does. > coalton is the closest thing and it's still missing a large amount of the type system. Note that this was written by one person. You have to distinguish between what has actually been done given the current state of the world and what would be possible if people made different choices. If a tenth of the effort that has gone into implementing Haskell had instead gone into implementing a Haskell-equivalent embedded in CL, that effort would plausibly be competitive with actual Haskell if not superior.