From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA32089; Thu, 28 Nov 2002 19:01:12 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA31998 for ; Thu, 28 Nov 2002 19:01:12 +0100 (MET) Received: from audi.ibcp.fr (audi.ibcp.fr [193.51.160.127]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gASI1BX07197 for ; Thu, 28 Nov 2002 19:01:11 +0100 (MET) Received: from pc-bioinfo1.ibcp.fr (pc-bioinfo1.ibcp.fr [193.51.160.63]) by audi.ibcp.fr (Postfix) with ESMTP id 5AB6A7A65F for ; Thu, 28 Nov 2002 19:01:11 +0100 (CET) Date: Thu, 28 Nov 2002 19:01:11 +0100 (CET) From: Martin Jambon X-X-Sender: martin@pc-bioinfo1.ibcp.fr To: caml-list@inria.fr Subject: [Caml-list] Type aliases Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I would like to have the following properties: 1) Define type aliases: type year = int and month = int 2) Don't hide their representation and derive the primitives from the original type: # let next_year = current_year + 1 ;; val next_year : year = 2003 (+) and 1 would be silently converted to types using year instead of int. 3) Prohibit the mixing of different types that do not derive from each other, without an explicit cast: let my_mistake = year + month (* Type error! *) where year has type year and month has type month. But this could be valid: let some_int = (year :> int) * 13 + month Basically, I would like to minimize the risk of error when I manipulate simple datatypes like numerical parameters or int/string identifiers. Thanks for any suggestion! Martin ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners