My good friend Ralf has pointed me at a brief mention of F# on the monthly TIOBE index , a programming

By on 10/21/2006 6:56 PM ()

I was able to download F# from an alternate link on microsoft research here

[link:research.microsoft.com]

Simply click on F# Compiler. I tried the one provided in the post, but apparently the link is broken.

By on 9/26/2006 2:25 PM ()

@Juraj:
I don't think number 1 relates to any of the problems
I have no idea about number 2(might be fine at all or might be the System.Windows.Form code), so far doesn't give me any trouble

about your GTK app:
changing

1
window.DeleteEvent.Add( fun _ -> Application.Quit () ) 

to

1
window.DeleteEvent.AddHandler( fun _ _ -> Application.Quit () )

makes it work,
anyways my version:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#light
// references are gdk, glib & gtk version 2.8 
open System
open Gtk
let quit _ = Application.Quit ()
let _ =
   Application.Init()
   let window = new Window("gtk sharp application")
   window.Resize(200, 200)
   let label = new Label() (* works without () too *)
   label.Text <- "testing fsharp"
   window.Add(label)
   window.ShowAll()
   window.DeleteEvent.AddHandler( fun _ _ -> Application.Quit () )
   Application.Run()
By on 9/24/2006 12:31 PM ()

Hello,

Here are my findings regarding new fsharp version 1.1.12.5 on mono (1.1.17.1):

1) during installation I noticed, that there was a change: the *ntc.{exe,dll} files were removed. Actually, this is not a problem, but might be related to the following ones.

2) When performing AOT compilation, mono reported some troubles:

<---snip--->

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Mono Ahead of Time compiler - compiling assembly /opt/fsharp/bin/fslib10.dll
Code: 447067 Info: 27142 Ex Info: 12747 Class Info: 16443 PLT: 1219 GOT Info: 2864 GOT Info Offsets: 3500 GOT: 4728
Executing the native assembler: as  /tmp/mono_aot_8KPBGT -o /tmp/mono_aot_8KPBGT.o
Executing the native linker: ld -shared -o /opt/fsharp/bin/fslib10.dll.so /tmp/mono_aot_8KPBGT.o
Compiled 3209 out of 3525 methods (91%)
0 methods contain absolute addresses (0%)
0 methods contain wrapper references (0%)
0 methods contain lmf pointers (0%)
316 methods have other problems (8%)
Methods without GOT slots: 1401 (39%)
Direct calls: 1282 (36%)
GOT slot distribution:
	methodconst: 2
	switch: 175
	class: 176
	image: 1
	vtable: 472
	sflda: 173
	ldstr: 130
	ldtoken: 14
	type_from_handle: 20
	iid: 7
	adjusted_iid: 12
AOT RESULT 0

<---snip--->

This might be a problem of mono but previous fsharp version 1.1.12.3 didn't have the "methods have other problems" problem. Also, I am not persuaded this is really a problem (maybe just some sort of warning?), because I can use fsharp compiler. The output for other dlls was very similar to this one.

3) Different behavior of following code (name of the file on disk is gtksharp.fs):

<---snip--->

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#light
#I @"/usr/lib/mono/gtk-sharp-2.0"
#r @"gtk-sharp.dll"
#r @"glib-sharp.dll"
open System
open Gtk
let _ =
    Application.Init()
    let window = new Window("gtk sharp application")
    window.Resize(200, 200)
    let label = new Label
    label.Text <- "testing fsharp"
    window.Add(label)
    window.ShowAll()
    window.DeleteEvent.Add( fun _ -> Application.Quit () )
    Application.Run()
<---snip--->

I compiled the above snippet of code with fscp10.exe, no complains from compiler, but when I run it, I got following:

<---snip--->

<code lang=fsharp>
Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
  at <StartupCode>.Gtksharp._main () [0x00000] 

<---snip--->

I adjusted code in a following way (not using anonymous function for application quit):

<---snip--->

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#light
#I @"/usr/lib/mono/gtk-sharp-2.0"
#r @"gtk-sharp.dll"
#r @"glib-sharp.dll"
open System
open Gtk
let quit _ = Application.Quit ()
let _ =
    Application.Init()
    let window = new Window("gtk sharp application")
    window.Resize(200, 200)
    let label = new Label
    label.Text <- "testing fsharp"
    window.Add(label)
    window.ShowAll()
    window.DeleteEvent.Add( quit )
    //window.DeleteEvent.Add( fun _ -> Application.Quit () )
    Application.Run()

<---snip--->

And everything went ok.
Furthermore I had to adjust the code snippet this way (maybe not a bug but valid syntax, I don't know) in order to compile with fsharp version 1.1.12.3. But it worked with anonymous function for application quit:

<---snip--->

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#light
#I @"/usr/lib/mono/gtk-sharp-2.0"
#r @"gtk-sharp.dll"
#r @"glib-sharp.dll"
open System
open Gtk
//let quit _ = Application.Quit ()
let _ =
    Application.Init()
    let window = new Window("gtk sharp application")
    window.Resize(200, 200)
    //let label = new Label                  (*!!!*)
    let label = new Label ()                 (*!!!*)
    label.Text <- "testing fsharp"
    window.Add(label)
    window.ShowAll()
    //window.DeleteEvent.Add( quit )
    window.DeleteEvent.Add( fun _ -> Application.Quit () )
    Application.Run()

<---snip--->

Hope it helps,
Juraj

By on 9/24/2006 5:37 AM ()
By on 9/23/2006 9:50 AM ()
By on 9/23/2006 9:43 AM ()
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