From: Stephane Glondu <Stephane.Glondu@crans.org>
To: Jonathan Roewen <jonathan.roewen@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Syntax errors with match and interface files
Date: Thu, 21 Jul 2005 17:26:24 -0700 [thread overview]
Message-ID: <42E03D30.5000406@crans.org> (raw)
In-Reply-To: <ad8cfe7e05072115424fc8d1eb@mail.gmail.com>
Hi,
Jonathan Roewen wrote:
> I'm getting a curious syntax error:
>
> [...]
>
> try
> let put c = putch c; Queue.add c buffer in
> match char_code with
> | Key.kEnter -> put '\n'
> | Key.kBksp -> put '\b'
> | ch -> put (Key.to_char ch)
> with Key.Not_printable -> ()
You cannot use defined variables as patterns (this is a common mistake).
Variables appearing in a pattern are always bound to (parts) of the
matched value. Something close to what you want would be :
try
let put c = putch c; Queue.add c buffer in
match char_code with
| ch when ch = Key.kEnter -> put '\n'
| ch when ch = Key.kBksp -> put '\b'
| ch -> put (Key.to_char ch)
with Key.Not_printable -> ()
Stephane Glondu.
next prev parent reply other threads:[~2005-07-22 0:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-21 22:42 Jonathan Roewen
2005-07-22 0:26 ` Stephane Glondu [this message]
2005-07-22 5:47 ` skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42E03D30.5000406@crans.org \
--to=stephane.glondu@crans.org \
--cc=caml-list@yquem.inria.fr \
--cc=jonathan.roewen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox