-
-
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
enable FFI at CT #9253
Comments
Generating code dynamically from the filesystem is a little hard when you can't do anything other than read statically known file locations at compile time. Ie, |
well there's |
For anyone else running into this it's work nothing that |
@yyyc514 |
Grrrr, guess I'll just forget about windows for now and revisit this later. :) |
FFI at compile-time is hard. Araq attempted it using libffi and gave up multiple times. If you're up for the challenge then by all means go for it, it would be an awesome feature (it would enable a proper REPL as well). Btw please search for related issues, I'm pretty sure there are plenty... |
Regular expressions are such a versatile tool that it is worth discussing if it should be a compiler vm feature. Then there is still no FFI but fast regular expressions at compile time. As dom96 pointed out, this problem is hard. Please try to come up with a solution if your really want this issue to be fixed. Because this issue will be opened again anyway, I will keep this issue open, but there is no active work to support calling into C function pointers from nimvm. I would like to mention though that Araq is working on a compiler plugin system that is not based on nimvm, here this problem would not raise again. |
I did, before submitting this issue (as I always do btw, although mistakes happen), and no github issue tracks enabling FFI at CT. Eg of searched keywords: libffi and importc. The only relevant thing is a 1 line comment by @zah in this closed (unrelated) issue #61 :
the only other thing that relates is a forum post: https://forum.nim-lang.org/t/4249#26456 (Why can't the Nim VM use FFI?) but I want to track this in gitbhub otherwise it'll never materialize. @Araq said:
I would love if @Araq could share a pointer to these attempts, to help with future work on this
I can see a number of practical ways to improve status quo:
|
A much better solution is to implement a regex engine in pure Nim, and that is what the |
=> PR #10150 |
use cases
discussion
EDIT
in https://forum.nim-lang.org/t/4249#26456 @Araq mentioned he had a working patch that allowed using FFI at CT for arbitrary importc procs, but it wasn't merged because it wasn't clear what to do with cases like these:
However we can definitely think of solutions for this case, eg:
links
EDIT
The text was updated successfully, but these errors were encountered: