Use the new module support coming in Emacs 25
jwiegley opened this issue · 9 comments
This is a great project! I wonder if you could achieve even better integration by using the new support for dynamically loaded C modules coming in Emacs 25.1. It would require a little more boilerplate to get a Haskell library "ready" for inclusion into Emacs, but it should eliminate some of the marshalling overhead in some cases.
Hi John!
I discussed this with Florian a little while ago - don't think he'll mind me posting.
Florian:
"""
I must confess that I didn't know about the native modules.
It seems to me that the only advantage of the native modules are the
avoidance of the pipe overhead, but with the big disadvantage of having
to recompile emacs and not beeing able to distribute via melpa.
I guess I'll wait a bit and look how it works
"""
Me:
""""
I don't think you have to recompile emacs - it loads .so files.
I think you could use the same model - I started with https://github.com/mwotton/emacsplugin which shows how you can compile a .so separately, then require it in emacs.
I agree that unless you can show the pipe overhead is really killing you it doesn't make much sense, and in any case it'll take a while for everyone to upgrade to 25.
"""
You are right, recompiling Emacs is not necessary. And also that if the overhead isn't killing you (if the module is largely computational, with small inputs and outputs), then piping is perfectly fine.
Hey John, what an honor to read your words on my tiny hobbyist project (I've actually got a totally different profession).
At least for now, I'd suggest to ignore the overhead until there pops up a high perf usecase, or are you limited in a specific case?
You are right, @knupfer, ignoring until a pressing need arises is the wise course. Good luck with your totally different profession! :)
@jwiegley is there a tutorial for emacs modules? I'd like to make a "hello world" modules that (say) sorts a buffer via haskell.
This looks like it may be a good starting point, although I have not tried it yet myself: http://diobla.info/blog-archive/modules-tut.html