Tarmil / FSharp.Data.LiteralProviders

F# Type providers generating literals from the compile-time environment
MIT License
135 stars 6 forks source link

Feature request: fully qualified nameof #27

Closed nodakai closed 1 year ago

nodakai commented 1 year ago

Background: https://stackoverflow.com/a/40856014/

The proposed trick only applies to C# (whose "constant expressions" include concatenations like nameof(Namespace) + "." + nameof(Namespace.Class)) Sadly we can't do the same with F# when you want some fully qualified type name to feed to e.g. [<assembly:AutoOpen(...)>]

If it's straightforward to add such a functionality to your Literal Providers suite, it would be awesome.

Tarmil commented 1 year ago

That would be useful, but unfortunately that is not possible with a type provider either. The TP receives its static parameters as already resolved values, it can't inspect the expression.

nodakai commented 1 year ago

Hmm right, I think I had some confusions on how typeof is implemented vs nameof, restrictions on TP parameters, and so on. Sorry for the noise.