On Mon, Nov 12, 2007 at 03:18:18PM -0800, James Harris wrote:
> On 12 Nov, 11:17, Robbert Haarman <comp.lang.m...@[EMAIL PROTECTED]
>
> wrote:
> > On Sun, Nov 11, 2007 at 10:10:54AM -0800, James Harris wrote:
> > > On 6 Nov, 08:39, torb...@[EMAIL PROTECTED]
(Torben ?gidius Mogensen)
> >
> > > > > Sorry, can't bring myself to go with inferred types. (Why do you
like
> > > > > them?)
> >
> > > > For several reasons:
> >
> > > > 1. It makes the programs shorter.
> >
> > > But it also makes them ambiguous.
> >
> > I don't see what you mean here. As long as the behavior of the type
> > inferencer is well-specified, I don't think there is anything about
type
> > inference that makes programs ambiguous.
>
> We are getting into areas I am not really ready yet to discuss but
> since you asked I am thinking of two cases (rightly or wrongly):
>
> 1. a human /reader/ would not know what data types were meant without
> examining a lot of context.
>
> 2. the code could easily apply more widely than the /writer/ intended
> (or wanted).
True, but neither of these make the program _ambiguous_. Whether they
are actually problems is a different matter, and since you indicated
that we are drifting away from what you wanted to discuss, I will not
get into that discussion now.
> > > > 2. You don't have to decide in advance how polymorphic/generic
your
> > > > functions are -- the type inference makes them maximally
> > > > polymorphic.
> >
> > > I want control over how polymorphic functions are.
> >
> > You can have type inference and still be allowed to specify types.
Then
> > you have control for when you need it, and succinctness when you want
> > it.
>
> I see your point. Lets say that if I read someone else's code I want
> to be able to see how polymorphic his functions are!
I see your point, but I feel it is getting the territory of "everybody
should do things the way I want them cause I think that's better for
me!". Type inference saves you work while developing and refactoring
code. This benefits everybody working on the project, including you.
I would like to add that type annotations have real value, and, in fact,
it is considered good practice to add them by the Haskell and OCaml
communities, even though these language do not mandate them. What I
typically do is write my code without type annotations first (saving
effort while adding and refactoring code), and then, when the time comes
for type annotations (for example, because I want to share the code with
someone else, or I am not sure about the inferred types myself), I have
the compiler generate the type annotations for me. This lets me focus on
the algorithms and the structure of the code, rather than annotations,
while still providing the latter.
Regards,
Bob
--
67.7234597% of statistics are made up.


|