Open Swoorup opened 4 years ago
I don't think it's possible to add varying arguments to a TP unfortunately. But I think it should be possible to make a nested class whose number of arguments (and their types) depends on the string passed at the root:
let [<Literal>] string = SPrintfFP<"Hello %s! 1 + 1 = %i">.Args<"world", 2>.Value
Interesting, that definitely makes sense given the lack of current support for the mechanism. My use case for this is to compose various SQL fragments as string literals and still consume it as literals so it can be fed to the SQL type provider
A sprintf would definitely be nicer, but in the meantime you should be able to just +
the strings:
let [<Literal>] connectionString = "Hello " + Env<"MyVar">.Value + "!"
Since this package is named
literal
providers, would it feasible to add sprintf like functionality using and get a string literal?I am not entirely sure if it is possible to add specify varying arguments to TP though?