Version française
Home     About     Download     Resources     Contact us    
Browse thread
Same label in different types, how do people solve this?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Functions must be explicitly typed, (was Same label in different types, how do people solve this?)
> >>>>> "Mattias" == Mattias Waldau <mattias.waldau@abc.se> writes:
> > I don't really see the use of infering types for functions. It works for one

I would like to note that type inference (i.e. code without
annotations) helps a lot when developing programs: the annotation free
code is not only easier to write but also easier to maintain since it
is kind of ``auto-adaptative'' and resistant to reorganisations and
names modifications.

As an example, consider a function with an explicit profile:

let (type_type_definition : Synt.td -> ...) = function ...

If we consider renaming the module Synt into Syntax, and the type td
into type_definition to reflect as closely as possible the intended
meanings, we would have to edit the definition of the function (and
the definition of every function that uses either the module Synt or
the type td). By contrast, if we omit manual type annotations, the
type checker will silently change the type assigments as necessary. It
is extremely convenient when writing systems that are rapidly
evolving.

Hope this helps,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/