Tuesday, November 30, 2010

Studying F# : catch the exception

In ruby, the clauses for catching some exception is like below:
begin
  # some actions
rescue
  # the action when error occurs
else
  # the action when error does not occur
ensure
  # the final action whether error occurs or not
end

But, in F#, there are two point that is different from ruby.

  1. There are no clause corresponding else.
  2. There are only clauses either try/with(corresponding begin/rescue) or try/finally(corresponding begin/ensure)

In other words, clause try/with/finally is Forbidden.

> let results =    
-     try
-         (1 / 0)
-     with
-         | ex -> "Some error occurs."
-     finally
-         "Final";;

      finally
  ----^^^^^^^

/Users/youhei/stdin(9,5): error FS0010: Unexpected keyword 'finally' in binding. Expected incomplete structured construct at or before this point or other token.

Saturday, November 27, 2010

Both openSUSE and Mono will be alive, maybe.

4 days ago, Novell agreed to be bought by Attachmate. And my interest is "Will both openSUSE and Mono be alive, or not?".

For Mono, there is a Miguel de Icaza's tweet.
After the Novell acquisition, Mono continues as-is, but our paychecks will come from Attachmate instead of Novell.

For openSUSE, there is a n article that says "openSUSE is safe".

I hope both projects are alive.

Wednesday, November 24, 2010

One more instruction for installing MonoDevelop F# add-in on Linux

If you install MonoDevelop F# add-in on Linux and you use with non-root user, you should do one more instruction:
sudo chmod a+w -R /etc/mono/registry/

Monday, November 22, 2010

F# in MonoDevelop on Mac OS X

In the article "F# in MonoDevelop and cross-platform web sites & screencasts", there are the instruction for installing F# in MonoDevelop on Linux. But someone ( of course, me too ) want to use this on Mac OS X and that instruction not suitable for on Mac OS X. So I introduce in this post.

0. Install F#

see also in this post.

Friday, November 19, 2010

.NET Book Zero equals Mono Book Zero

.NET Book Zero is the most famous book as free and online PDF, for C# beginners.
http://www.charlespetzold.com/dotnet/

But, of course, this book also useful for Mono beginners like me. I am reading both this book and Professional F# 2.0.