The "()" on line 11, that is : after [...]Running()) will generate an error even in F#.

This fake unit value is, in the sample you pasted, in the middle of your class declaration.

So if you meant : declare a mailbox processor and then return unit, you should modify the identation : the "()" in your sample is aligned with "let hellYeah _", not with "Mailbox".

Otherwise, it just won't work, you can't call this value in the middle of a class implicit constructor.

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

type Worker() =
  let hellYeah _ = 
    MailboxProcessor.Start(fun inbox -> 
      let rec Running() = 
        async { return() } 
      Running())
    () //aligned to be the value returned by hellYeah

  do hellYeah()

Does it work ?

By on 5/19/2009 3:27 PM ()

Hi thanks for the help, I think that problem may of been an artifact of pasting my code into this textbox. however i made sure the alignment was as you suggested and it still failed.

I also tried this, which appears to call hellYeah as part of construction, this still failstype Worker() =
let hellYeah =
MailboxProcessor.Start(fun inbox ->
let rec Running() =
async {return()}
Running())
()

I also tried this, an object of worker type can be constructed from xaml.cs but the method call CallYeah() fails

type Worker() =
let hellYeah _ =
MailboxProcessor.Start(fun inbox ->
let rec Running() =
async {return()}
Running())
()

member w.CallYeah() = hellYeah()

Below I've included my command line that I use to compile the F# library, as I thought that maybe I'm missing some required library or perhaps a flag is incorrect.

"C:\Program Files\FSharp-1.9.6.2\bin\fsc.exe" --fullpaths --optimize- --cliroot "C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0" -r System.Windows --noframework -a -r System.Net -r System.Runtime.Serialization --standalone Worker.fs

Cheers Daniel

By on 5/20/2009 12:01 PM ()

This problem was resolved when referencing the silverlight compiled version of FSharp.Core.dll which is supplied with latest version of F#.

Regards

By on 6/16/2009 5:50 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