News for hackers. Stuff that matters.
Re:Roll your own minilanguages with mini-interpreters (1989) by pjc50 on Tuesday July 06, 2021 @02:23PM (#27752376)
I cannot imagine a situation where a small interpreted language is "too complicated" but "free monads" are not.
Re:Roll your own minilanguages with mini-interpreters (1989) by valenterry on Tuesday July 06, 2021 @07:48PM (#27755791)
Let me help your imagination: the users of your language ask you to help them get auto completion when they write code in this language.

How much more complicated would that make things based on the two choices?

And, just for completeness, here's an example that turns things around: your users are asking you to change the syntax und use lisp-like evaluation/expressions. So (* 3 (+ 1 2)) instead of 3 * (1 + 2). Or, they ask you to do it the other way around.

How much more complicated would that make things based on the two choices?

Re:Roll your own minilanguages with mini-interpreters (1989) by pjc50 on Wednesday July 07, 2021 @02:42AM (#27758097)
At this point rather a lot more weight is being put on the DSL than a mere minilanguage, so I'd embed a language interpreter for something existing. I've used Tcl for this in the past.

But when you say "users", that indicates a different use case anyway. The minilanguage is basically source compression or code generation, it's for the developers.

> your users are asking you to change the syntax und use lisp-like evaluation/expressions

Nobody ever wants that except Lisp users, and if you're surrounded by angry lisp users you should just give them what they want and embed a lisp. Or even just write one, Scheme is small enough.

But as far as I can tell, "free monads" are a lot of machinery to re-implement imperative stateful programming when you could have just used a language that wasn't Haskell in the first place.

Re:Roll your own minilanguages with mini-interpreters (1989) by valenterry on Wednesday July 07, 2021 @03:05AM (#27758232)
> At this point rather a lot more weight is being put on the DSL than a mere minilanguage, so I'd embed a language interpreter for something existing.

Sure, but then why not just use the (host) programming language directly?

> But when you say "users", that indicates a different use case anyway. The minilanguage is basically source compression or code generation, it's for the developers.

I meant developers as well - they are still users of your language no? :)

> Nobody ever wants that except Lisp users

If you are just going to disregard all use-cases and examples I give, then of course in the end we will end up with a solution-space where all my arguments don't apply. You said you can't imagine such a situation, I gave you an example. I can't really do more than that.

> But as far as I can tell, "free monads" are a lot of machinery to re-implement imperative stateful programming

Not at all. And free monads are completely orthogonal to Haskell and very useful in non-pure-functional programming languages as well. I think this conversation is not very fruitful without a basic understanding of what they are.