Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: ergonomie du compilateur
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Frank Christoph <christo@n...>
Subject: Re: ergonomie du compilateur
> So what could the compiler do to help?  I suppose that it would be possible
> for the toplevel to throw you into a prolog like interpreter when it hits a
> type error.  You could enter type variables and it would reply with the type
> that is the value of the type variable, etc.  There would be a predefined
> predicate |- for type judgements.  This would make the metalevel type
> inference as accessable and perhaps as understandable as the baselevel
> values.

  This is an interesting idea and I have some sympathy for it.  But I suspect
it might confuse some beginners even more, especially those who have never
used Prolog, since

  * the type unification has nothing to do with the execution model
  * it requires learning a new syntax for routine debugging .

But I could be wrong.  You have to learn a new command syntax to use existent
command-line debuggers anyway...

  I once suggested a related feature to Alastair Reid, but for Haskell program
editors.  I thought it would be useful if the user could click on an
identifier and have the type displayed.  This can be more useful in Haskell
than in ML because of type classes and the extended inference algorithm.  I
think he told me that, in an old release of the Yale Haskell system (when they
were still using LISP as a backend!), something of the sort was once possible
but Yale has sinced scrapped that implementation.

  Rice has a very nice Scheme programming environment called DrScheme which
includes a static debugger ("MrSpidey") that can do soft type inference.  It
essentially lets you do what I described above: you run the inferencer, click
on an identifier and it pops up a box next to it that displays a set
expression indicating what kinds of values the variable might hold at
run-time.  There is a description of it in the PLDI '96 proceedings, "Catching
Bugs in the Web of Program Invariants" by Matthew Flatt, et al. It's really
neat; if you have time, I recommend downloading it and checking it out for
yourself, even if you're not really a Scheme programmer.  (I'm not.)

http://www.cs.rice.edu/CS/PLT/packages/drscheme

Note:
I just checked the site and it looks like the newest release (47) is lacking
the debugger, so I recommend you get an earlier one, like version 42.

-- 
Frank Christoph                 Next Solution Co.      Tel: 0424-98-1811
christo@nextsolution.co.jp                             Fax: 0424-98-1500