Hi, it works fine here -
I tried it in the latest version of FSI (F# 1.9.3.14) and the output is following:

1
2
3
4
5
6
7
8
9
10
11
12
13
 

> #light
- let expect_throw<'a when 'a :> exn> f =
-   try
-     f()
-     // Assert.Fail("should throw")
-     "fail"
-   with
-     :? 'a as e -> e.Message
- ;;

val expect_throw : (unit -> unit) -> string

What version are you using? Do you use FSI or FSC? Can you try it using the latest version?

By on 3/20/2008 4:05 PM ()

I'm using version 1.9.3.14. I just now tried it with fsi and it

worked, but when compiled with fsc (via Visual Studio 2005) it gives me

the error.

By the way, I'm running into a similar situation with the following code snippet:

1
  async { do raise e in return 0 }

fsi accepts this, but fsc does not. With fsc I have to write

1
2
async { do raise e
           return 0 }
By on 3/20/2008 4:28 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper