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

Support usage as a library #4

Closed
frenata opened this issue Mar 8, 2018 · 1 comment
Closed

Support usage as a library #4

frenata opened this issue Mar 8, 2018 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@frenata
Copy link
Owner

frenata commented Mar 8, 2018

See #2. I'm hopeful this will actually be a relatively minimal change, mostly involving reviewing what is and isn't exported.

@frenata frenata added the enhancement New feature or request label Mar 8, 2018
@frenata
Copy link
Owner Author

frenata commented Mar 11, 2018

box = compilebox.New("data/compilers.json")

http.HandleFunc("/languages/", getLangs)
http.HandleFunc("/eval/", evalCode)

At a minimum, these are the functions that need to be "exposed" for use as a library.

New exists as well, New.

evalCode exists as EvalWithStdins, though this begs the question of whether there should be a plain Eval We should think hard about the actual API for that function too, as well as how errors should be handled.
There might be some fun higher-ordered function stuff that can be done with Eval too. :)

getLangs pulls from an exported field LanguageMap and then does some manipulation, so that functionality should probably be extracted into a method on the box itself.
Since we have enabled/disabled fields in the language map, it would also be nice to expose an API to modify this on the fly.

@frenata frenata added this to the 0.1.0 milestone Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant