[mercury-users] The Mercury Language

Peter Ross peter.ross at miscrit.be
Tue Sep 5 23:28:38 AEDT 2000


On Tue, Sep 05, 2000 at 06:18:53PM +1100, Peter Schachte wrote:
> Hi all,
> 
> There is an interesting interview with Brian Kernighan at
> 
> 	http://www.cs.cmu.edu/~mihaib/kernighan-interview/index.html
> 
> When asked why functional languages don't catch on, his reply was:
> 
>     I think, speaking only for myself, part of the reason that ML in
>     particular, and functional programming languages in general have not
>     caught on more broadly, is that they're aimed at people who have
>     mathematical sophistication, who are able to think in more abstract
>     ways, that lots of other folks, and I include myself, have trouble with.
>     Whereas languages like C are very operational, you can see how every
>     single piece of them maps into what's going on in the machine in a very
>     very direct sense. If I had been brought up at a different time and in a
>     different environment perhaps I'd be totally comfortable in ML and would
>     find C unsafe, a little dangerous, not very expressive.
> 
> I think all of this applies as much to Mercury as it does to ML.  So the
> question I have for those interested in seeing Mercury "catch on" is:  is
> the correct solution to this to educate the masses to use more sophisticated
> abstractions, or would we do better trying to simplify some of the concepts
> (while retaining Mercury's declarativeness) to make it easier for the
> average developer or uni student to pick up?  Or is it better to accept
> Mercury's current level of popularity and get on with the research?
> 
> I'm not trolling; I'm interested in what Mercurians think about this.
> 
Personally my CS education started with Pascal (back in the days when
engineering students did a different course to science students),
followed by C where all the science students had learnt Miranda (so we
had continual references to Miranda).  I personally fell in love with
functional programming languages just after being presented binary
search trees in C, which was compared with the implementation in
Miranda.  I found that despite having done almost two semesters of
imperative programming and no course on functional programming that they
functional solution was *much* easier to understand and so neat.

However my first experience writing a non trivial declarative program
wasn't so succesful.  I was writing the Mercury profiler, and needed an
efficient tree structure (at this stage tree234 didn't exist) so decided
to implement red-black trees having just done a algorithm course (in C).
My first attempt was an attempt to map the imperative algorithm
presented in Sedgewicks "Algorithms in C" into Mercury.  A complete and
utter disaster!  Fergus then sat down with me, and showed me how to
write it declaratively, much easier.

The problem with my first attempt was that by this stage of my CS
education (3 or 4 semesters in) I was used to thinking imperatively, and
all the documentation I ever read was written imperatively, so making
the mind shift was quite hard.

The difficulty of this mind shift has also been illustrated by the
students I have taught in data structure and algorithm courses.  All
of them have learnt Haskell for 1 semester and C for 1 semester.  The
algorithms and data structures in the main were presented in C for the
course and the projects set were to be written in C.  A lot of the
projects mapped quite nicely to recursive solutions, but because their
latest education had been imperative lately, all the students could
think of was for/while loops and all the associated pointer ugliness of
pass-by-reference.

So in my experience, one of the main reason declarative languages
haven't caught on is that courses may initially start with some
declarative component, but quickly the courses become weighted to
producing imperative programs so the students never learn to think
declaratively.

Just my two cents.

Pete
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list