[m-users.] C/C++ Programmers Intro to Mercury Slides

Paul Bone paul at bone.id.au
Wed Jul 6 11:37:50 AEST 2016


On Wed, Jul 06, 2016 at 12:13:49AM +0200, Tomas By wrote:
> Hello,
> 
> A couple of comments: `purely functional' may have some conventional meaning
> I guess, but I am not sure what `purely logical' would mean, and it seems
> contradictory to say Mercury is both `purely X' and `purely Y'

I've noticed a bit of confusion about what "purely functional" means
recently.  Before this post I saw it on quora.com but cannot find the link
anymore.

I've seen people mistakenly think that "purely functional" means something
like "only functions".  In the same way that if I said "pure chocolate" one
would normally take this to mean that the chocolate is not diluted or
tainted in some way.

"Purely functional" actually means that the language has functions, and
those functions are pure (side-effect free).  A more general term is "purely
declarative".  The normal sense of the "pure" makes sense in "purely
declarative": The declarative semantics are not diluted or tainted.  Then,
just as functional programming and logical programming are specific types of
declarative programming.  Pure functional programming and pure logical
programming are types of pure declarative programming.

So since Mercury requires that both functions and predicates are side-effect
free, it supports both pure logical and pure functional programming; it is a
"pure logical/functional language".

I can accept that terms like this can be difficult, and that someone hearing
"purely functional" for the first time may make some incorrect assumptions.
I've also seen people use terms like "strongly typed" incorrectly, saying
things like "Haskell is more strongly typed than Java".  Confusing the
separate concepts of strong typing, static typing and type system
expressiveness.  Although I'm a language descriptivist, I think it's
important to use these terms of art correctly.

This also reminds me of words like "theory" which is sometimes misunderstood
in "the theory of evolution".  I find this a bit trickier because in some
ways "theory" has two meanings, "strongly typed" and "purely functional"
don't.


-- 
Paul Bone


More information about the users mailing list