I'm using a type provider to create a versioned api, where you can choose to select older versions of a component to call than the current lastest version.
At the moment, it puts these in a namespace that looks something like:
Provided.ComponentName.VersionName(... this is the type constructor ...)
ComponentName is a namespace at the moment, if that makes a difference.
Once I've built all the specific versions of the component, I'd also like to expose:
Provided.ComponentName.Latest(... constructor ...)
as either a static method or a type alias that will return an instance of the most recent version.
What's the best way of doing this?
I don't think there is a way to generate F# type alias (which would be a nice way to alias
Latestto a specific version of the type).As an alternative, I suppose you could generate
VersionNameas a nested type andLatestas a static method that returns the appropriate version of the type. To do this,ComponentNamewould have to be a type containing other types & one static method:The only ugly thing about this is that
VersionNameis a type (and can be created usingnew) whileLatestis a static method and so it won't work withnew.