Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Johann Spies <jspies@sun.ac.za>
To: caml-list@yquem.inria.fr, caml-list@inria.fr
Subject: Re: [Caml-list] question on exceptions
Date: Mon, 16 May 2005 10:43:11 +0200	[thread overview]
Message-ID: <20050516084311.GH10979@sun.ac.za> (raw)
In-Reply-To: <Pine.LNX.4.62.0505131529060.19887@hydrogene.pps.jussieu.fr>

On Fri, May 13, 2005 at 03:34:22PM +0200, Julien Verlaguet wrote:
> I have the following peace of code
> 
> exception E;;
> let x=E;;
> exception E;;
> 
> I don't understand why the two following things are not equivalent :
> 
> # x=E;;
> - : bool = true
> 
> # match x with
>   | E -> true
>   | _ -> false;;
> - : bool = false
> 
> Is this normal ?

Maybe.  I am no expert but I suspect the second "exception E;;" causes
the behaviour that you saw.  Look at this:

# exception E;;
let x=E;;
exception E;;
exception E
# val x : exn = E
# exception E
#  x=E;;
- : bool = true
#  match x with
  | E -> true
  | _ -> false;;
    - : bool = false

So far it is the same, but

# exception E;;
exception E
# let x=E;;
val x : exn = E
#  x=E;;
- : bool = true
#  match x with
  | E -> true
  | _ -> false;;
    - : bool = true

Regards
Johann
-- 
Johann Spies          Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

     "In my Father's house are many mansions: if it were not
      so, I would have told you. I go to prepare a place for
      you. And if I go and prepare a place for you, I will 
      come again, and receive you unto myself; that where I 
      am, there ye may be also."        John 14:2,3 


      reply	other threads:[~2005-05-16  8:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13 13:34 Julien Verlaguet
2005-05-16  8:43 ` Johann Spies [this message]

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=20050516084311.GH10979@sun.ac.za \
    --to=jspies@sun.ac.za \
    --cc=caml-list@inria.fr \
    --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