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
Latest
to a specific version of the type).As an alternative, I suppose you could generate
VersionName
as a nested type andLatest
as a static method that returns the appropriate version of the type. To do this,ComponentName
would have to be a type containing other types & one static method:The only ugly thing about this is that
VersionName
is a type (and can be created usingnew
) whileLatest
is a static method and so it won't work withnew
.