[m-dev.] Re: Calling an arbitrary predicate from mdb
Tyson Dowd
trd at cs.mu.OZ.AU
Thu Dec 3 12:39:36 AEDT 1998
On 03-Dec-1998, Peter Schachte <pets at cs.mu.OZ.AU> wrote:
>
> I also think it's important, though, for users to be able to indicate
> that certain predicates are only used when debugging, and should not
> be included in final executables. This may be as simple as a switch
> to turn on and off dead code elimination, but in this case dead code
> elimination needs to be pretty clever about type classes.
It depends.
If you have the general possibility of doing a type class check
to see if arbitrary terms are in a type class, you need to have
the type class method code around all the time.
If you only allow type class checks in debugging, you need to
make sure it can be dead code eliminated.
Incidently, I think the way to do this is to automatically generate
initializers for type class check tables, and simply make the dead
code elimiation consider the initializers as a usage of the method.
>
> > > > Ideally, you should be able to load and unload a Mercury-compiled
> > > > shared object from the debugger commandline also.
> >
> > Yes, well, as discussed at the Mercury meeting today this is a big
> > step for a rather small functionality gain.
>
> I can't comment on how big a step it is, but I think the gain in
> functionality is potentially very significant. If, for example, the
> compiler could load code at runtime, it would be possible to implement
> preprocessors of various sorts (eg, the global variable package I
> described yesterday) as external bolt-ons, rather than having to build
> every such thing into the compiler itself. Being able to plug in
> other specialized program analyzers, too, would be very useful. It
> would be useful for other applications, too, to be able to dynamically
> load and call code, for example the battleship program mentioned in a
> recent mail message, if I understand what it's meant to do, would
> benefit by being able to load two separately-written player modules.
I was referring to the benefits for being able to load and unload pretty
printers for terms. This is a pretty small benefit.
The benefits of dynamic code loading for programming in general are large.
--
Because I dislike being quoted I lie almost constantly when talking
about my work.
-- Terry Gilliam
Tyson Dowd <tyson at tyse.net> http://tyse.net/
More information about the developers
mailing list