Skip to content

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Feb 2, 2016

In this FSharp.Data PR, we added general support for cross targeting erasing type providers to the CommonProviderImplementation.

This PR brings this support across into the type provider starter pack so it can more easily be used by other type provider projects. The README edits and the FSharp.Data PR explain how the code works. Roughly speaking, we determine the referenced set of assemblies, and if you create your provided objects using

    let ctxt = ProvidedTypesContext.Create(config)
    ...
    let myType = ctxt.ProvidedTypeDefinition(asm, ns, "MyType", typeof<obj>)

then your provided quotations and type definitions will be "remapped" to the approriate set of target referenced DLLs automatically.

I'm also hopeful that we can use this machinery to allow erasing type providers that target .NET Core (when the F# compiler is running on .NET Framework) and vice versa. But we would also need to make the ProvidedTypes code compilable as a .NET Core component, which may not be straight-forward.

This PR also includes some updates from FSharp.Data and some testing for FSharp.TypeProviders.StarterPack.

I also suggest we rename this repo to FSharp.Compiler.ProvidedTypes and make it much more officially the "home" of the ProvidedTypes API, with full documentation, samples and testing in the style of FSharp.Data etc. We could also start providing this component as a DLL assuming there are no loading, deployment or versioning issues with that (quite a large assumption).

p.s. Note that this PR includes the (large) AssemblyReader.fs file, which is independently valuable as an all-F# single-file .NET assembly reader, for cracking the metadata (though not the code) of an IL assembly without using .NET reflection. We may expect Paket file references to appear to this single file (@forki was using one already to the FSharp.Data copy of this file).

@dsyme dsyme changed the title [WIP] General support for cross-targeting erasing type providers Support for erasing type providers targeting portable profiles Feb 2, 2016
@dsyme
Copy link
Contributor Author

dsyme commented Feb 2, 2016

I'd like this code reviewed by people before we accept it - please! :)

@ovatsus After it is accepted I will submit a PR to FSharp.Data to pick up this implementation and check that all tests pass there.

@dsyme dsyme changed the title Support for erasing type providers targeting portable profiles Support for targeting portable profiles with erasing type providers Feb 2, 2016
@dsyme dsyme changed the title Support for targeting portable profiles with erasing type providers Support for authoring type providers which target portable profiles Feb 2, 2016
@panesofglass
Copy link
Contributor

Thank you, @dsyme!

dsyme added a commit that referenced this pull request Feb 9, 2016
Support for authoring type providers which target portable profiles
@dsyme dsyme merged commit 77fda2a into fsprojects:master Feb 9, 2016
@7sharp9
Copy link
Member

7sharp9 commented Mar 2, 2016

Erasing is mentioned here but are generatives affected by this PR in anyway? //cc @dsyme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants