caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr>
To: Jonathan Roewen <jonathan.roewen@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] infix functions
Date: Fri, 27 May 2005 13:12:55 +0200	[thread overview]
Message-ID: <17047.183.987063.355357@gargle.gargle.HOWL> (raw)
In-Reply-To: <ad8cfe7e050527030652565b3@mail.gmail.com>


Jonathan Roewen writes:
 > 
 > For instance, the Int32 (etc) modules are horrible to use cause of the
 > prefix functions. These are perfect candidates for being infix. And
 > being an OS project, there are a lot of instances where we need the
 > extra precision, and having to do things like add some_int32
 > another_int32 complex. Especially when you have to throw in
 > bitshifting, AND and OR, and other magic.

In some simple cases, it can help to insert

	let (+) = Int32.add
	let (-) = Int32.sub
	...

at the  beginning of your files  (or better to  put these declarations
within  a small  module that  you open  only when  you need  the infix
notation).  You  can even  adopt  other  notations,  such as  +!,  -!,
etc.  Only the  first  character  is used  to  determine the  operator
precedence.

Beware of the lexical issue with multiplication :-)

Hope this helps,
-- 
Jean-Christophe


  parent reply	other threads:[~2005-05-27 11:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-27 10:06 Jonathan Roewen
2005-05-27 10:58 ` Richard Jones
2005-05-27 12:46   ` padiolea
2005-05-27 14:20     ` William D. Neumann
2005-05-27 11:12 ` Jean-Christophe Filliatre [this message]
2005-05-27 11:13 ` Vincenzo Ciancia

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=17047.183.987063.355357@gargle.gargle.HOWL \
    --to=jean-christophe.filliatre@lri.fr \
    --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;
as well as URLs for NNTP newsgroup(s).