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

Extract JS specifics from library #61

Open
joneshf opened this issue Sep 26, 2017 · 9 comments
Open

Extract JS specifics from library #61

joneshf opened this issue Sep 26, 2017 · 9 comments

Comments

@joneshf
Copy link
Contributor

joneshf commented Sep 26, 2017

This library is wonderful. I'd like to start using it with purerl. But the problem is, it has dependencies on specifics of JavaScript. There are still a couple of FFI modules here, and there's a dependency on purescript-js-timers. Are you interested in making this library able to be used by different backends? I don't want to suggest that you should maintain different backends though. That's kind of a big ask from me.

I have some ideas how this could be separated out, but I don't want you to have to maintain multiple libraries or have to jump through hoops to get things working. Assuming you're interested in allowing different backends, do you have any thoughts on how you'd like to make that possible?

@owickstrom
Copy link
Collaborator

Thanks! Would be very cool to have it running on purerl. I have almost zero experience with Erlang, but if you (and/or others) can do the heavy lifting, then sure!

So, purescript-js-timers could be removed as in #62, that seems all right. And you did the -ansi conversion as well. Are there other problematic ones? I see the purerl organization has a bunch of common libraries ported.

I'll try building and running your PRs!

@joneshf
Copy link
Contributor Author

joneshf commented Sep 27, 2017

There is dateNow: https://github.com/owickstrom/purescript-spec/blob/557bec79c7d88bfd24764e5b6ab3ba2fc5c6e87b/src/Test/Spec/Runner.js#L6-L8. That could be replaced with https://pursuit.purescript.org/packages/purescript-now/3.0.0/docs/Control.Monad.Eff.Now#v:now

There are two spots that still use process:

The write one feels like it could be replaced with Console.log, but it might take changing how write is used.

The exit one is a bigger problem. If it was just node that was the thing, I'd suggest having a library for dealing with process stuff and letting that be FFI'd in each backend. But phantom doesn't require an entirely new backend to compile it, so it's harder to suggest that. Although, if it were a thing, this function (in a completely different library) could go away as well: https://pursuit.purescript.org/packages/purescript-test-unit/13.0.0/docs/Test.Unit.Main#v:exit

I don't know that splitting this library into the plain PS stuff and the JS FFI'd stuff is a good idea either. Seems like purerl should just maintain a fork at that point.

So I'm leaning toward:

  • Submitting a PR to use purescript-now
  • Maintaining a fork of this repo for the purerl process stuff.

@owickstrom
Copy link
Collaborator

OK, not that much at least.

It seems these are so small and few, and they aren't changing much, so may the third alternative be that we add the .erl FFI modules directly in this repository? I could give you push access so that you could maintain the Erlang stuff here, if you'd like?

@joneshf
Copy link
Contributor Author

joneshf commented Sep 27, 2017

That's definitely an option. I would only feel comfortable doing that if the travis stuff could be integrated as well. I guess that means we'd have to have binaries for purerl ready to go (we should have that anyway). I don't know how much an increase on build times that would make either. Are you okay with the build also doing Erlang stuff?

@owickstrom
Copy link
Collaborator

@joneshf Agreed, a Travis build would be important. I think if we use a build matrix we could run them in parallel, and keep the time down. It would probably increase the complexity of the build configuration, but I'm all right with that.

@owickstrom
Copy link
Collaborator

Do you have such a build set up for any other purerl projects?

@joneshf
Copy link
Contributor Author

joneshf commented Sep 28, 2017

I don't, I should try to throw one together though.

@owickstrom
Copy link
Collaborator

Cool! Ping me if there's anything you need help/feedback on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants