[m-rev.] Mail delivery broken at mercurylang.org
Volker Wysk
post at volker-wysk.de
Wed Nov 12 17:24:22 AEDT 2025
Am Dienstag, dem 11.11.2025 um 13:13 +1100 schrieb Mark Brown:
> There are plenty of times when I've been asked why I think Mercury is
> good, particularly by people who consider OO-design to be good, and
> who consider "declarative programming" to be an idealistic concept
> that has worn a bit thin. I'd like to give such people a more
> pragmatic answer.
Mercury can be seen as a form of declarative programming that actually
works.
To the ones which are fond of object oriented programming, I'd say that
Mercury isn't object oriented, but it provides most of the abstraction
concepts that OOP provides. It's just that you don't have all of them at the
same time, which might be a good thing. But I'm not very sure here.
You can do OOP-like things with Mercury, such as by using existentinal types
and type classes. But I haven't found a way yet, to emulate class
hierachies/inheritance (for catching exceptions). Perhaps more OOP could be
done with some boilerplate code.
>
> >
> > Logic programming is more universal than functional programming. This
> > can be
> > seen at the fact that functional programming can relatively easy been
> > added
> > to a logic language. Just transalte a function f(a,b,c) = x to a
> > predicate
> > f(a::in, b::in, c::in, x::out). In the opposite direction, it should be
> > much
> > harder.
>
> I imagine that a typical Haskell programmer would point to the List
> monad as an alternative to backtracking, and might mention laziness at
> some point. One might also ask whether universality is even the
> question, given that they are Turing complete languages.
Universality doesn't mean Turing completeness here. It means, how directly
you can express your ideas.
>
> Not that I disagree with you on the facts, that's not the point. I'm
> just questioning what kind of argument should be made on the home
> page.
>
> >
> > Logic is more fundamental than functions (or lambda calculus), in
> > mathematics.
> >
> > Logic is closer to human thinking (or even to thinking in general). Or,
> > at
> > least to the logical part of human thinking.
>
> That makes sense to me, insofar as logic is intended to be a model of
> human reasoning. One might ask which logic, though. Classical? Does it
> have to be Horn clauses? And is our audience trying to model human
> thinking, or are they trying to model computation?
Both at the same time...
>
> > You can transform your ideas to
> > code more directly.
>
> I agree with this, although I was framing it as compositionality. A
> chunk of Mercury code looks like a complete definition of something,
> as long as you keep in mind how the variables are quantified.
> Furthermore, you can readily "slice" the code in your own mind while
> reading it, to just consider the parts of a predicate that are
> relevant to whatever question you have. In practice I have found this
> to be a massive advantage in reading and understanding code, including
> my own code.
Hmmm.... I can't say much here.
Cheers,
Volker
More information about the reviews
mailing list