caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Denis Bueno" <dbueno@gmail.com>
To: "Gerd Stolpmann" <info@gerd-stolpmann.de>
Cc: "Edgar Friendly" <thelema314@gmail.com>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Patterns that evaluate
Date: Wed, 14 Feb 2007 14:10:20 -0500	[thread overview]
Message-ID: <6dbd4d000702141110o12e2c703m7638b50029fd57a9@mail.gmail.com> (raw)
In-Reply-To: <1171479313.24335.33.camel@localhost.localdomain>

On 2/14/07, Gerd Stolpmann <info@gerd-stolpmann.de> wrote:
> You are a bit quick. Before discussing syntax it is more important to
> define the semantics of such patterns. I mean we have already three
> predefined kinds of equality in O'Caml:
>
> - ( == )
> - ( = )
> - (fun x y -> compare x y = 0)
>
> I admit I do not prefer any one of them. So which equality should be
> used to test whether the variable is equal to the matched part of the
> value?
>
> I guess this simple question is one of the reasons why such a feature is
> not in the language up to now.

I agree with Gerd: equality is a hard thing to get right.

For many months now I have been working on a compiler for a constraint
solving language, and I always need to spend a significant amount of
time, after the creation of each data structure, defining comparisons
on instances of those structures. Usually there is one that defines an
ordering for the purpose of using instances as keys in a Map; and
sometimes there are additional equivalence relations that compare
different aspects of structures.

The principle then, applied to this problem, is: immediately *someone*
is going to need a comparison function other than the ones above. And
if there is no support for such functions, many people will consider
the feature useless for all but the simplest of tasks. If there is
support, it will become a question of just how convenient that support
is.

These aren't necessarily un-answerable questions; but they are not easy.

-Denis


  reply	other threads:[~2007-02-14 19:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-13 22:04 Jacques Carette
2007-02-13 22:07 ` [Caml-list] " Jon Harrop
2007-02-14  0:10   ` Jacques Carette
2007-02-14 18:20   ` Edgar Friendly
2007-02-14 18:55     ` Gerd Stolpmann
2007-02-14 19:10       ` Denis Bueno [this message]
2007-02-14 19:11       ` Jacques Carette
2007-02-14 19:25         ` Gerd Stolpmann
2007-02-14 20:30           ` Edgar Friendly
2007-02-14 21:05       ` Jon Harrop
2007-02-14 21:33         ` Jacques Carette
2007-02-14 22:34   ` Martin Jambon
2007-02-15  0:26     ` Jacques Garrigue
2007-02-15  3:57       ` Jon Harrop
2007-02-15 22:43         ` Don Syme
2007-02-14 20:29 ` Nathaniel Gray
2007-02-14 21:10   ` Jacques Carette
2007-02-15  3:53     ` skaller
2007-02-15 13:41       ` Jacques Carette
2007-02-15 14:10         ` skaller
2007-02-15 20:43     ` Nathaniel Gray
2007-03-07 11:15       ` Oliver Bandel

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=6dbd4d000702141110o12e2c703m7638b50029fd57a9@mail.gmail.com \
    --to=dbueno@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=info@gerd-stolpmann.de \
    --cc=thelema314@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).