Open alanhaw opened 4 years ago
Hi @alanhaw, did you figure out a workaround or solution to this problem? I'm stuck with the same need for a 4-argument function and I don't really want to use the un-type-safe way
In the circumstances I was in, I needed 4 arguments but they were related. So I re-wrote my code to group the arguments as pairs, and thus passed only 2 arguments into createFunction. But this is not a general solution.
On Oct 27, 2020, at 12:13 PM, stuart312 notifications@github.com wrote:
Hi @alanhaw https://github.com/alanhaw, did you figure out a workaround or solution to this problem? I'm stuck with the same need for a 4-argument function and I don't really want to use the un-type-safe way
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stephencelis/SQLite.swift/issues/1010#issuecomment-717429104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AENSVQZOPDVEHMSATPZIJYTSM4ETNANCNFSM4OKUQXAA.
looks like a needless limitation, could easily add more arguments
sqlite.swift version: 0.11.6 - from ChangeLog.md, 0.12.2 from info.plist bundle version (downloaded Feb 20/2020) XCode version: 11.3.1 (11C504) macOS 10.14.6 sqlite.swift was integrated with the project manually
With the following code:
The code compiles except that the definition of test3 reports an error at the beginning of "{ anumer". It seems to be that createFunction works with 1 or 2 parameters, but not with 3 (nor 4, I've tried). The error is: "Contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored".
When I observe the expression lookup as I type in "db3.createFunction" it looks like there are an awful lot of typed definitions of createFunction. I am wondering if the multiple definitions are confusing the compiler, giving the error. This may be specific to certain XCode versions [speculation].
This has been questioned on stackoverflow awhile back: https://stackoverflow.com/questions/57383494/how-to-properly-define-closure-for-custom-function-in-sqlite
And to add an example with 4 parameters:
This returns a compile error of: "Contextual closure type '([Binding?]) -> Binding?' expects 1 argument, but 4 were used in closure body"