-
Notifications
You must be signed in to change notification settings - Fork 53
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 for Flow Annotated Javascript as new codegen target #24
Comments
Hi, I'm the original author of atd (including atdgen). Due to conflicting priorities, I won't be able to spend sufficient time supervising the addition of new features to the existing codebase. @rgrinberg has been the most active on the project recently and he did some massive cleanup, but we haven't pushed new user-facing features in a long time. Some of the code has gotten really too complicated and makes it hard to add new features easily. Given this situation, I think it would work better if the addition of a new code generation backend was done as a separate project. It gives you more freedom and more responsibility, while encouraging atd to expose a clean API. That said, if someone is willing to take over the supervision of the whole atd project with all due credit (@rgrinberg?) and is capable of maintaining clean boundaries between code generators, that would work perfectly. An option is to create a subproject for the new code generator, much like |
Martin Jambon <notifications@github.com> writes:
All the cleanup that I'm doing is actually with an eye towards adding a
JS target. Although I'm looking for something that is specific towards
jsoo. So I'd love to help out @bwestergard with this task, but I do
think that the cleanups are a prerequisite for doing this work.
I also think it will be a good idea to fold atdj into this project as
well. All the codegen backends can from sharing more than just the API.
Testing, documentation, evolving the API, CI, are all easier when this
is all centralized.
But as I said, the cleanup work is required before proceeding with all
these lofty goals.
In summary, I'd love to help out with adding a new backend and make it
easier so that this is more easily done in the future :)
|
@bwestergard, @grinberg will help you. For getting started, in my experience the most important thing is to nail down what code you're going to generate. How I proceed is by writing down sample code as I want it generated, and then write the OCaml code that translates the trees representing type definitions into code. Another general piece of advice is to have one module per major translation or per concern. The file naming conventions for the atdgen source are |
@bwestergard you'll start from an AST provided by the |
@bwestergard as for emitting indented code, I was happy with what atdgen uses: it produces a tree made of |
See discussion of analogous task for JSONSchema type definitions and discussion of Bucklescript as codegen target.
Would the maintainers of this repo accept PRs to support Flow-safe javascript code generation? Any advice on getting started?
The text was updated successfully, but these errors were encountered: