Version française
Home     About     Download     Resources     Contact us    
Browse thread
Strange parsing of with-clauses
[ 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] Strange parsing of with-clauses
Richard Jones wrote:
> Not a big problem, but strange nevertheless:
> 
> # exception E of string * string;;
> exception E of string * string

Exception E is a constructor accepting two arguments, not a single tuple 
of two elements.

> # let f () = raise (E ("a", "b"));;
> val f : unit -> 'a = <fun>
> # try f (); failwith "Not found" with E (a,b) -> (a,b);;
> - : string * string = ("a", "b")
> # try f (); failwith "Not found" with E t -> t;;
>                                        ---
> The constructor E expects 2 argument(s), but is here applied to 1 argument(s)
> 
> (In my actual code I want to return the thrown tuple to the caller).

This is the point.

Try

exception E of (string*string)


or

type thrown_tuple = string * string
exception E of thrown_tuple

> Rich.
> 

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/>