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 XAA18083; Fri, 7 Nov 2003 23:35:40 +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 XAA18794 for ; Fri, 7 Nov 2003 23:35:39 +0100 (MET) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hA7MZc117661 for ; Fri, 7 Nov 2003 23:35:38 +0100 (MET) Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id hA7MZVC05393; Fri, 7 Nov 2003 16:35:32 -0600 (CST) Date: Fri, 7 Nov 2003 17:34:18 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Chris GauthierDickey cc: caml-list@inria.fr Subject: Re: [Caml-list] labels in records? In-Reply-To: <3FAC1C3B.6070100@cs.uoregon.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 tilde:01 val:01 tilde:01 chris:01 ocaml:01 labelled:01 int:01 int:01 labels:01 nov:01 syntax:02 wrote:03 types:03 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 7 Nov 2003, Chris GauthierDickey wrote: > Is it possible to use a labelled function as a member of a record? > > In other words: > > let f ~x = x + 1 > > type { g: ~x:int -> int } > ^ > syntax error No tilde. Try: type t = { g: x:int -> int } One nice thing about ocaml, is that the top level prints out syntax-correct types. So, you see: # let f ~x = x + 3 ;; val f : x:int -> int = # Note that lack of a tilde on the type definition. I just mention this because it's how *I* remember when a tilde is needed and when it isn't :-). Brian ------------------- 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