Version française
Home     About     Download     Resources     Contact us    
Browse thread
Another polymorphism puzzle
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Baretta <alex@b...>
Subject: Re: [Caml-list] Another polymorphism puzzle
Jacques Garrigue wrote:
> From: Manos Renieris <er@cs.brown.edu>
> 
>>Worse:
>>
>># let f x = { () with foo = 3};;                    
>>val f : 'a -> int t = <fun>
>># let f x = { 42 with foo = 3};; 
>>val f : 'a -> int t = <fun>
>>
>>I think this qualifies as a bug. Especially since the documentation
>>says the expr on the left hand side of with has to be a record.
> 
> 
> What do you mean by worse? You just exhibit an immediate consequence
> of the typing of f below.

I think that "worse" here stands for "completely counterintuitive".

> Following the manual, the typing could be more restrictive, but the
> current typing is perfectly sound.
> 
> Jacques Garrigue

I doubt that any one of us has every written buggy code like the 
examples in this thread, yet, it it ever happens out of pure thermal 
agitation in the PS2 cable, I would expect the type checker to track 
down such "unsound" code, even if it would not cause a segfault.

Alex

-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>