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 BAA10652; Thu, 24 Oct 2002 01:58:56 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 BAA10698 for ; Thu, 24 Oct 2002 01:58:56 +0200 (MET DST) Received: from str12.sobor.org (adsl-63-198-183-99.dsl.snfc21.pacbell.net [63.198.183.99]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g9NNwsD24032 for ; Thu, 24 Oct 2002 01:58:55 +0200 (MET DST) Received: from localhost (localhost.localdomain [127.0.0.1]) by str12.sobor.org (Postfix) with ESMTP id ABFB610C5C; Wed, 23 Oct 2002 19:46:49 -0400 (EDT) Date: Wed, 23 Oct 2002 16:46:48 -0700 (PDT) Message-Id: <20021023.164648.41658460.avv@quasar.ipa.nw.ru> To: alex@baretta.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Again on pattern matching and strings From: "Alexander V.Voinov" In-Reply-To: <3DB73515.90705@baretta.com> References: <3DB73515.90705@baretta.com> X-Mailer: Mew version 2.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi Alessandro, From: Alessandro Baretta Subject: [Caml-list] Again on pattern matching and strings Date: Thu, 24 Oct 2002 01:47:33 +0200 > | Some ( "\027(U\001\000\005" ) -> ... > | Some ( "\027@" ) -> ... > | Some ( "\012" ) -> ... > > And so on. This is completely unreadable. I think this > problem requires a solution like C++ const variables: values > which the compiler considers compile time constants and > directly substitutes into the code in place of the > identifier name. Now, "const" is rather meaningless in a > functional language, so I suggest "alias" as a better > alternative. For example > > alias printer_set_unit = "\027(U\001\000\005" > > whereby such an identifier cannot be hidden by a new let > binding (compile-time error) and is considered a constant in > patterns. You can use camlp4 for this. One of the entry level examples concern introduction of named constants. Alexander ------------------- 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