Let me see if I grok your question...

You know you can create types that refer to each other (type Foo ... and Bar ...). And you know you can create functions that refer to one another (let rec f ... and g ...). But you want to make some types and some functions (or 'global' values) mututally recursive with one another. Yes?

Unfortunately the language does not support this. You can work around it by declaring the function (or value) as a static member function in one of the mutually recursive types. So something like

1
2
3
4
5
6
7
8
9
type Feed = ...

and FeedItem = ...

    static let d = new Dictionary...

    static member SubjectDictionary = d

... FeedItem.SubjectDictionary ...  // used throughout this code, or later

See also [link:cs.hubfs.net]

By on 1/21/2009 7:20 PM ()

Thanks Brian. I got wrapped up in the fun of learning F#, and forgot to say "thank you" for your help.

Thank You!

By on 2/20/2009 10:48 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