Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 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,
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper
download Interscript