Skip to content
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

Build flag to disable Lua and/or all C bits #5164

Closed
tarleb opened this issue Dec 18, 2018 · 4 comments
Closed

Build flag to disable Lua and/or all C bits #5164

tarleb opened this issue Dec 18, 2018 · 4 comments

Comments

@tarleb
Copy link
Collaborator

tarleb commented Dec 18, 2018

Prompted by hslua/hslua#73. Platform-independent support for hslua is sometimes tricky, and it can become an issue for porting efforts, e.g. hslua/hslua#67. Naturally, I'd rather see the underlying issues resolved, so this is only a stop-gap measure.

A flag to disable all C bits might, on the other hand, be helpful also to people trying to compile pandoc with GHCJS. That's much more involved, so disabling Lua would only be a first step.

@jgm
Copy link
Owner

jgm commented Dec 18, 2018

See #4535 - there's a list there of all the cbits in our transitive dependencies. It's hopeless to disable them all.

@jgm
Copy link
Owner

jgm commented Dec 18, 2018

Perhaps it's worth considering a flag to disable lua support. However, I believe it's considered bad practice to have your API change depending on the settings of cabal flags. Maybe it could be possible to keep the same API but raise an exception if lua support is not compiled in?

@tarleb
Copy link
Collaborator Author

tarleb commented Jan 5, 2019

I've played with this for a bit. The only way to make this work is to move all occurrences of the Lua type inside Text.Pandoc.Lua, to never expose a function with type Lua in its signature, and to stop exposing module Text.Pandoc.Lua. This is simple enough, but it seems that this would deprive library users of useful functionality. On the other hand, library users write Haskell instead of Lua to extend pandoc.

If the goal is to keep exposing "raw" pandoc Lua functionality, then one solution could be to leverage finer-grained library packages. E.g., having a pandoc-core package would make it possible to write a pandoc-core-lua and pandoc-core-nolua packages, which would then be used by pandoc proper. Cabal 2 supports having multiple libraries in the same cabal file, and finer grained modularity could solve a lot of portability issues. But there are obvious and undeniable costs in complexity and maintenance to this approach.

The issue seems to be of low priority now that the hslua cross-compilation issue has been resolved. Should we close this for now in favor of #4535?

@jgm
Copy link
Owner

jgm commented Jan 5, 2019

I'm in favor of closing this if there isn't an urgent need for it.

@tarleb tarleb closed this as completed Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants