Am I nuts to try Mercury for this?

tcklnbrg at at ingenuity-sw.com
Fri May 22 09:23:23 AEST 1998


So the title asks:  

I am working on a pattern-based code generater for another language
(Java).  I have been using Prolog and find it to be generally
satisfactory for this.  I notice however that alot of my Prolog code is
doing instantiation and type checking   Also, most of my code is very
simple DCG-type stuff.

I want to be able to build up a large (probably messy) rule-base of
functor patterns for code generation and not have to eventually worry
(alot) about program speed or completion.  

But my colleagues are already P/O that I am not writing this in Java
itself.  I have been telling them that there is a 100% pure Java
implementation coming from Paul Tarau of Bin Prolog so they can think of
Prolog as just a scripting language for rules.  They are not amused at
the prospect of learning another language much less one that is widely
considered both wierd and dead.

However, I cannot figure out how to build and use a reliable rule-base
in Java without essentially winding up with something like a "Prolog in
Java", but with all the 1.0 problems and *with* all the existing
problems of Prolog itself. I don't want to reinvent the wheel (and
probably don't have the time or talent to do it anyway.)  

After looking over my alternatives, I stumbled on Mercury.

One of the particular reasons I want to do "pattern" based generation is
that Java's class libraries and frameworks require you to build based on
syntax patterns, yet the patterns are not part of the language itself.  
In particular the AWT and Swing GUI classes are *not* built on pixels
but on relative relationships.  I just went to a Sun briefing and its
clear they are going to be building practically everything based on
interfaces and syntax patterns from now on.  Java is winding up with
alot of "rules" that are not built into the compiler or runtime. Java
Beans are a prime example and there alot more of this type of thing on
the way for Java.

Also, the Java IDE's and GUI builders are notoriously big and slow, and
just getting worse all the time.  Since Java does not build well at all
visually, I find that productivity in trying to "draw" an app is rather
poor.  Productivity on a reasonable laptop is one of my goals, also and
that's next to impossible with the conventional GUI/IDE Java builders.  

but, I am having a hard time trying to "sell" the idea of building based
on rules rather than "drawing" the app on screen.  Yet, I am coming to
the conclusion that bulding without rules and patterns is hopeless for
systems of any size.  I am beginning to think that moving to rules and
patterns is not an option---I will bury them in quality and productivity
of code, if I am right.

But, I do have several concerns surrounding Mercury:

???

Is Mercury just another lab project that is going to die when the
current funding or current mentor disappears?

How stabile is Mercury right now?  If I build and deploy a big rule-base
in it will it crash all over the place?

Is there any support in the Prolog community for transitioning to
Mercury or a successor?

Interoperability with other languages, ie. Java?  Right now, I will have
to use pipes or files, I suppose, but Java is CORBA-enabled.  Can
Mercury be CORBA-enabled? or Might there be another way to link Mercury
and Java?

(Yeah, Yeah, Java is a defective language:  but its class libraries now,
and coming have no equal.  They are a must-have for serious enterprise
apps.)

The Java chips are coming--at that point Java will be "hardware-fast"
and be running on very small devices.  Imagine intelligent mail-handling
on say a Palm Pilot running Java with a Prolog-type rule-base. 
Everybody will soon know what Java is, but "what the hell is Mercury and
why would anyone want it if its not Java?"???

At this point my use for Mercury is for code development purposes, not
end-user apps.  But, one of these days, I want a rule-based system that
can be embedded into Java apps.  Is the Mercury team thinking of making
a Mercury-In-Java?  What about a Mercury to Java compiler (ie,  Paul
Tarau's "Jinni", in late beta )?  

Also, I like having the command-line type interpreter for testing new
snippets of code---SWI's is nice.  Any way to do something similar with
Mercury, currently?



I would really appreciate comments on all of this.  


Best Wishes,

Ann Tecklenburg



More information about the users mailing list