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 TAA25308; Thu, 14 Jun 2001 19:33:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA25675 for caml-list@pauillac.inria.fr; Thu, 14 Jun 2001 19:33:57 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA19316 for ; Thu, 14 Jun 2001 15:02:50 +0200 (MET DST) Received: from mta02-svc.ntlworld.com (mta02-svc.ntlworld.com [62.253.162.42]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f5ED2bj06722 for ; Thu, 14 Jun 2001 15:02:50 +0200 (MET DST) Received: from htec.demon.co.uk ([62.252.166.133]) by mta02-svc.ntlworld.com (InterMail vM.4.01.02.27 201-229-119-110) with ESMTP id <20010614130235.DNBM290.mta02-svc.ntlworld.com@htec.demon.co.uk>; Thu, 14 Jun 2001 14:02:35 +0100 Message-ID: <3B28B658.AF3E9B39@htec.demon.co.uk> Date: Thu, 14 Jun 2001 14:04:24 +0100 From: Chris Quinn X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.4.0-test6 i686) X-Accept-Language: en MIME-Version: 1.0 To: leary@nwlink.com CC: caml Subject: Re: [Caml-list] enums in OCaml? References: <20010612192126.B24440@jean> <20010614011550.A28578@jean> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk A recent thread on the subject: http://caml.inria.fr/archives/200105/msg00168.html There's mention of an SML extension that solves this problem (ie. retaining the good typing properties). Are the Caml designers considering this? Chris Q. leary@nwlink.com wrote: > > Ok, I see how I can do this with a sum type and a function on it; but > that's also a lot of repetitive setup. Seems I could also just make a > function that acted on strings: > > let message_to = function > "accel" -> 1 > | "stop" -> 0 > | _ -> -1;; > > ...which is perhaps less typing/editing up front, but a bit of a pain to > type all the "s in the code. > > So, what's so wrong with just using variables? > > let Accel = 1;; > let Stop = 0;; > > seems pretty short to write and shortest to use... Am I missing something > ( elegant | obvious )? Is that just ugly? > > thanks ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr