-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Foreign function interface at Compile Time #10150
Conversation
Now with |
b16d3a5
to
dbea28d
Compare
yay! One step closer to getting a fast Nim REPL :D |
Please elaborate on the "edge cases not yet supported or buggy". That test is currently a bit minimal. Can you run an interactive SDL application with an OpenGL context in a window at compile time? |
I'm curious, does this fix #8405 as well? |
@zah The reason why this should not be enabled by default is, because we have doubts that this will work reliably. So yes when this really works well for all use cases, it should be enabled by default, because yes it is useful. But I looked into how FFI works and my suspicion is that this feature is a can of worms that should be locked behind an experimental flag. Timothee uses libffi, so he outsources the wormy problem to an external library. |
The unwritten policy is that new features start behind an |
(still need to push my latest changes btw) |
This might be intepreted that you would need this flag to use any kind of FFI in Nim. With that said, I can't come up with any better name. |
|
ok finally getting back to this:
mostly, but not all cases; we can add missing support in subsequent PRs. import strutils
# const a = "abc" in "abcdef" # dosen't yet work because `tyRange` isn't mapped in `mapType`
const a = "abc".countLines # this works fine
echo(a)
|
testament/categories.nim
Outdated
echo "output OK" | ||
removeFile("outputGotten.txt") | ||
removeFile(megatestFile) | ||
#testSpec r, makeTest("megatest", options, cat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is here so much diff in categories.nim? AFAIK this file doesn't need to be touched to test compile time FFI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's not needed. As far as I can tell #10611 is unrelated to this PR. Please disconnect this PR from the other one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's not needed.
I just removed it.
As a result, as explained in #10611, I can't test this PR using my own travis instance, so my previous workflow doesn't work anymore:
- A1: test a commit locally; if green:
- A2: push on a private branch; if my personal travis instance is green:
- A3: push on PR branch; this runs on shared travis resources
the point of A2 being to avoid wasting shared travis resources for the benefit of everyone. Now that A2 doesn't work, I have to keep rebasing/removing that PR each time, or skip A2 altogether
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noted in a previous comment to elaborate what local travis is. This pretty much explais it to me. Still it won't harm if you describe it in the PR anyway. But no you don't need to "keep rebasing/removing". Just skip A2 altogether, you can always reintroduce it if you find a way to make it work.
Merging so that we don't lose this work but I'll disable it afterwards. |
just in time for the new year!
[EDIT]
the test shows, as an example, that we can use these at CT:
sure, there may be edge cases not yet supported or buggy, but that's already super useful
note
#10611 should be merged first (ignore it in the diff); it's needed because of #10632EDIT: removed it