Tips on designing a .NET API for future use with F#
- by Drew Noakes
I'm in the process of designing a .NET API to allow developers to create RoboCup agents for the 3D simulated soccer league.
I'm pretty happy with how the API work with C# code, however I would like to use this project to improve my F# skill (which is currently based on reading rather than practice).
So I would like to ask what kinds of things I should consider when designing an API that is to be consumed by both C# and F# code.
Some points.
I make fairly heavy use of matrix and vector math. These are currently immutable classes/structs.
The API currently defines a few interfaces with the consumer implements (eg: IAgent), using instances of their implementations (eg: MyAgent) to construct other API classes (eg: new Client(myAgent)).
The API fires events.
The API exposes a few delegate types.
The API includes several enums.
I'd like to release a version of the API as soon as possible and don't want to make major changes to it later if I realise it's too difficult to work with from F#. Any advice is appreciated.