Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long term aim: Remove use of reflection to create target quotations #300

Open
dsyme opened this issue Apr 9, 2019 · 0 comments
Open

Long term aim: Remove use of reflection to create target quotations #300

dsyme opened this issue Apr 9, 2019 · 0 comments

Comments

@dsyme
Copy link
Contributor

dsyme commented Apr 9, 2019

Type providers must generate quotations for the target context of referenced assemblies in order to hand these to the F# compiler. This is done by the TPSDK, taking design-time quotations to target quotations.

This approach is entirely reasonable. However, it hits limitations in the F# quotations library in FSharp.Core where FSharp.Core.Quotations is overly stringent in the checks it applies, forcing some (but not all) quotations to be design-time quotations. For example, when you call Expr.Lambda, FSharp.Core forces this to be for the design time type FSharpFunc rather than any FSharpFunc in the target assemblies.

As a result, we use a set of hacks into FSharp.Core to make "unchecked" quotations.

We should urgently remove the need for this hack by making an improvement to FSharp.Core, to to either

  1. Have FSharp.Core allow "unchecked" quotations to be created, where the checks are simply skipped, OR

  2. Have FSharp.Core make the checks to be with respect to a set of target assemblies

The first is easier. I'll create a corresponding issue in Microsoft/visualfsharp since the change really needs to be made there.

@dsyme dsyme changed the title Short term aim: Remove use of reflection to create target quotations Long term aim: Remove use of reflection to create target quotations Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant