Version française
Home     About     Download     Resources     Contact us    
Browse thread
Is this a bug?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Is this a bug?
From: Thomas Fischbacher <tf@functionality.de>
> If we look at the following piece of code:
> 
> ===>
> type dof_region_spec = (string * bool * (int option array)) array;;
> type opt_field_restriction = dof_region_spec option;;
> 
> let make_field ?(name="Field") ?restriction ?constant_value mwe =
>    let restriction:opt_field_restriction = restriction in
> 	failwith "FOO";;
> <===
> 
> ...then make_field types as:
> 
> ===>
> val make_field :
>    ?name:string -> ?restriction:<hidden> -> ?constant_value:'a -> 'b -> 'c
> <===
> 
> The <hidden> actually should not show up here. What is going on?

You could call it a printer "bug", but it's probably not worth fixing.
The problem is that opt_field_restriction hides the "option" type
constructor. To recover it one would have to expand it, but the
printer is not supposed to do type expansion (it must show the types
as they are).

So I would be tempted to say that a reasonable fix would be to replace
<hidden> by <option hidden>, to make things clearer?

Note that this is purely a printer problem. The type-checker itself
shall work correctly.

Jacques Garrigue