caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Raj B <rajb@rice.edu>
To: caml-list@yquem.inria.fr
Subject: C-like macros in OCaml
Date: Tue, 26 Jun 2007 17:00:40 -0500	[thread overview]
Message-ID: <1B4EC64C-435D-42C5-95F3-C01869DD41FB@rice.edu> (raw)

Hi there

Is there any way I can achieve the use of C-like preprocessor macros  
in OCaml?
i.e.

#define FOO 1

etc.

I am using an array of bits (a bitset) where each bit represents a  
flag, and i would like to
access this set by using names rather than remembering which index in  
the array represents which flag.

Similarly, is there any way of getting a C-like enumeration? e.g.

enum days {Mon = 1, Tue, Wed...}

I guess that OCaml does not provide these by default, but I wonder if  
someone has done some camlp4 magic
to use these.

Thanks
Raj


             reply	other threads:[~2007-06-26 22:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-26 22:00 Raj B [this message]
2007-06-26 22:06 ` [Caml-list] " Jonathan Bryant
2007-06-27  4:10 ` Richard Jones
2007-06-27  7:43   ` Jeremy Yallop
2007-06-27  8:08     ` Loup Vaillant
2007-06-27 12:53       ` Christopher L Conway
     [not found]         ` <6f9f8f4a0706280037h5f19af5flb764e1c2999b0337@mail.gmail.com>
2007-06-28  7:38           ` Loup Vaillant
2007-06-28  7:44         ` Nicolas Pouillard

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=1B4EC64C-435D-42C5-95F3-C01869DD41FB@rice.edu \
    --to=rajb@rice.edu \
    --cc=caml-list@yquem.inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).