2. Asynchronous operations. If I do not have a mapping I need to issue a request to a data feed from which I will receive the response asynchronously via a CLI event raised on a background thread.

Writing asynchronous code in F# is a breeze - considerably easier than other languages! Robert Pickering has written some excellent and relevent blog posts on both topics of interest to your problem:

Also, since the documentation is still incomplete, be sure to open the source code for the "Microsoft.FSharp.Control.CommonExtensions" module (see "%ProgramFiles%\FSharp-1.9.4.17\source\fsharp\fslib\control.fs"; look for "Module CommonExtensions =") This module not only shows where the BCL has been augmented with asynchronous calls, it also provides examples of how you could augment your own asynchronous methods to work with F# Asynchronous Workflows.

By on 5/28/2008 4:30 PM ()

Hi Les,

1. Pretty much any where you want to use a CLR Dictionary you can use an F# Map instead. However because maps are immutable they are consisterably slower that Dictionaries in some scenarios. It's sounds like preformance maybe an issue here, so possibly your better off sticking with a design that uses CLR Dictionaries.

2. Most F# data structures are read-only by default this means you can share them between threads without any problems. However, since the typical method to share data between theads is update a global reference which doesn't work two well with read-only data structures as they read-only you have no way to update a global data structure. This means you need to find some way to pass from the stack of one thread to another. There are two basic ways:

- using the parameters of your events

- using a mailbox as a message queue

I know this advise is a little cryptic but I'm in the process of putting together a blog post on this subject and it takes quite a lot of explaining. Should be ready in the next few days thought.

Cheers,
Rob

By on 5/28/2008 2:55 AM ()

Hi guys,

I'm a proponent of "change one variable at a time", or at least at the rate you feel comfortable. That is, with F# you can take an incremental (rather than revolutionary) approach to adopting new techniques, because the language is basically multi-paradigm. While you get used to the language you can, if you wish, simply code the architecture that you are comfortable with from your existing .NET experience. And use the data structures you already know.

As you use F# you will become more familiar with other techniques, particularly using immutable data structures as a routine part of your work, as Rob has said. The use of some mutable shared memory data structure sounds reasonable in your application, for your basic data store. This is common in F#: you have basically one shared memory data structure (e.g. a dictionary) protected by locks and the rest of your programming is functional.

Kind regards

don

By on 5/28/2008 6:20 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