caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: ergonomie du compilateur
@ 1997-01-20 21:33 Quercia
  1997-01-21  9:10 ` Pierre Weis
  1997-01-21 10:31 ` Emmanuel Engel
  0 siblings, 2 replies; 13+ messages in thread
From: Quercia @ 1997-01-20 21:33 UTC (permalink / raw)
  To: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 1500 bytes --]

> En effet, souvent une erreur de typage intervient à une ligne donnée
> pas à cause d'un problème à cette ligne, mais à cause d'un problème à une
> ligne antérieure. S'il est souvent assez facile de retrouver où a été typé
> un terme, cela devient quelquefois difficile, notamment avec les fonction
> récursives, pour le type de la fonction.
> Ne pourrait-on pas faire que, sur demande, le compilateur, lorsqu'il
> rencontre une erreur de type, ressorte d'où il a inféré les types qui lui
> posent problème?

Bonne idee ! En attendant, dans ce genre de situation, je place en
commentaire (ou je rajoute un failwith "") tous les cas sauf un pour
examiner le type de chaque cas.
Primaire mais efficace ...

> A typing problem in a line of code often happens not because this line is
> buggy, but because some previous line is, from which the types of terms i=
> the current line have been inferred. Often it's not too difficult to trac=
> where those inferences took place, but it's sometimes tedious, especially
> with recursive functions.
> Couldn't the Ocaml compiler be made to have, on request, more verbose
> messages on typing errors, including the trace of inferences of the terms
> to cause problems?

Good idea ! Meanwhile I comment out (or add a failwith "") every case
but one to see the type of the remaining case. Crude but effective ...

-- 
Michel Quercia
Lycee Carnot  16 bd Thiers  21000 Dijon
e-mail = querciam@l-carnot1.ac-dijon.fr
cc = 101702.425@compuserve.com (LG. Vidiani)





^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: ergonomie du compilateur
@ 1997-01-22 17:17 David Gurr
  1997-01-23 14:18 ` Frank Christoph
  0 siblings, 1 reply; 13+ messages in thread
From: David Gurr @ 1997-01-22 17:17 UTC (permalink / raw)
  To: caml-list; +Cc: gurr

I think that the biggest difficulty people have with types in ML is
conceptual.  Neither Lisp/Scheme nor C/C++/Pascal programmers are
likely to understand types and their role in ML.  Maybe the following
pedantic exposition would make things clearer.  A ML system has two
separate things that effectively execute code;ie two "interpreters". The
first is the value interpreter and is more or less the same as a Scheme
interpreter, the second is the type interpreter and can be thought of
as a very specialized Prolog interpreter.  When you enter a line of
code on a ML interpreter, it is executed by *both* interpreters.  The
type interpreter does a unification driven search for the type of the
code.  And the value interpreter does a reduction driven simplification
for the value of the code.  The single bit of subtilety is that the
value interpreter actually interpretes the code after it has been
rewritten with explicit types (using the type determined by the type
interpreter).

This points out three areas of conceptual difficulty.  Because type
inference is done at compile time, and because it resembles "type
checking" a la C etc, people often think of type checking as being part
of parsing rather than as part of the execution of the program.
Because types are trivial in the common languages, people do not
recognize that types are as integral to the meta-level execution of ML
(which takes place during compilation) as values are to the
iso/base-level execution of ML (which takes place during runtime).
Because logic programming is not common, people are befuddled by ML
type inference.

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.

-D

My apologies for no French version, you would rather not find out how
bad my French is.





^ permalink raw reply	[flat|nested] 13+ messages in thread
* ergonomie du compilateur
@ 1997-01-15  9:46 David Monniaux
  1997-01-21 10:33 ` Xavier Leroy
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: David Monniaux @ 1997-01-15  9:46 UTC (permalink / raw)
  To: Caml-list

-- VERSION FRANCAISE --
Bonjour à tous,
je trouve un aspect pénible au compilateur Ocaml, ou d'ailleurs au
toplevel, c'est son report d'erreur. En effet, il est quelquefois assez
difficile de retrouver l'origine du problème.
Si les messages du type "Parse error", bien que peu explicites, ne sont
toute de même pas trop pénibles quand on a l'habitude (il suffit
pratiquement de compter les parenthèses!), il n'en est pas de même pour
les messages d'erreur de typage.
En effet, souvent une erreur de typage intervient à une ligne donnée non
pas à cause d'un problème à cette ligne, mais à cause d'un problème à une
ligne antérieure. S'il est souvent assez facile de retrouver où a été typé
un terme, cela devient quelquefois difficile, notamment avec les fonctions
récursives, pour le type de la fonction.
Ne pourrait-on pas faire que, sur demande, le compilateur, lorsqu'il
rencontre une erreur de type, ressorte d'où il a inféré les types qui lui
posent problème?

-- ENGLISH VERSION --
Hello all,
I find the Ocaml compiler, or the toplevel, sometimes quite tiresome with
its error reporting. It is sometimes difficult to trace the origin of an
error.
While the messages of the "Parse error" kind, if not very explicit, are
not too bothersome because with some experience one can fix that kind of
errors quite easily (most often, just count the parenthesises!), this is
not the case for typing errors.
A typing problem in a line of code often happens not because this line is
buggy, but because some previous line is, from which the types of terms in
the current line have been inferred. Often it's not too difficult to trace
where those inferences took place, but it's sometimes tedious, especially
with recursive functions.
Couldn't the Ocaml compiler be made to have, on request, more verbose
messages on typing errors, including the trace of inferences of the terms
to cause problems?

-- David Monniaux, student at ENS-Lyon
"Si l'informatique marchait, cela se saurait."







^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~1997-02-03  8:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-20 21:33 ergonomie du compilateur Quercia
1997-01-21  9:10 ` Pierre Weis
1997-01-21 10:31 ` Emmanuel Engel
  -- strict thread matches above, loose matches on Subject: below --
1997-01-22 17:17 David Gurr
1997-01-23 14:18 ` Frank Christoph
1997-01-24  2:51   ` Jacques GARRIGUE
1997-01-15  9:46 David Monniaux
1997-01-21 10:33 ` Xavier Leroy
1997-01-21 10:35 ` Claude Marche
1997-01-21 12:54 ` Hendrik Tews
1997-01-23 16:37   ` Ian T Zimmerman
1997-01-30  9:55   ` Xavier Leroy
1997-01-31 14:21     ` Donald Syme

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).