fsharp / fsharp.github.io

F# Core Engineering Group
http://fsharp.github.io
45 stars 53 forks source link

Add detailed specification for what is and isn't possible with type providers #57

Closed 7sharp9 closed 4 years ago

7sharp9 commented 8 years ago

Especially around the difference between generative and erasing providers.

Some question and notes dumped off the top of my head:

Generative providers

Here are some things I would like clarifying:

How to add types that are generated and have root providers with static parameters.

e.g

type myType = Provider<Param="test">

There are only a few reference on this creating-a-generative-type-provider the-trips-and-traps-of-creating-a-generative-type-provider-in-fsharp

Both contain the basics of creating a ProvidedAssembly and adding the provided types to the ProvidedAssembly but it not clear on the correct order to avoid obscure compile failure messages.

e.g.

If you have another assembly which merely injects its types then you can use the AddAssemblyTypesAsNestedTypesDelayed which avoids encountering some of the above, but thats only useful if you are sending a command to an external code generator etc

When is SuppressRelocation useful?

When is ResetEnclosingType useful?


It would be good if there were canonical examples of the more common usages of generative providers, especially the areas I outlined above, as the documentation is really sparse.