English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2000-12-14 (18:15)
From: John Max Skaller <skaller@o...>
Subject: Re: Same label in different types, how do people solve this?
Chet Murthy wrote:

> The issue, about practicality, isn't whether you _can_ specify the
> particular types and type-usages you want.  The issue is whether, if
> you write a phrase, and you got it wrong, you have to know all about
> the type system, in order to debug that phrase.

It is a tradeoff. Full inference makes code short: lack of
inference severely pollutes programming style (as in C++).
In Felix, I compromised: functions must be explicitly typed
when declared, but values don't:

	function f(a:int): int { val b = a; return b; }

f must be explicitly typed. The type of b is deduced.
Compare with

	let f a = let b = a in b;;

The explicit typing of functions avoids a need for
a full scale type inference algorithm. 

John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net