Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Again on pattern matching and strings
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alessandro Baretta <alex@b...>
Subject: Re: [Caml-list] Again on pattern matching and strings


Fred Smith wrote:
> Hi,
> 
> Instead of altering the language why not
> 
> type printerCommands = PrinterSetUnit | ...;;
> 
> and the function
> 
> match <scanning function> with
> | "\027(U\001\000\005" -> PrinterSetUnit
> | ... -> (* other cases *)
> | "" -> assert false
> 
> The rest of your program can then be independent of these bizarre strings.

Not really. I need to use these strings in a couple of 
different places, so I'd like to be able to define them only 
once, as constant identifiers, or aliases, and forget them 
entirely.

Alex

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