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

Split the library #2

Open
tomek-he-him opened this issue Sep 9, 2015 · 2 comments
Open

Split the library #2

tomek-he-him opened this issue Sep 9, 2015 · 2 comments

Comments

@tomek-he-him
Copy link
Member

Right now the library does two things implicitly:

  1. parse an XML tree looking for parametric attributes, returning the so-called VirtualTree;
  2. update the XML tree with new calculations.

I’d like to split the two steps into two separate libraries – a parser and a patcher. They’d communicate using a separately-versioned AST format. Many other low-level libs have gone this way and succeeded (http://npm.im/commonmark, http://npm.im/virtual-dom, http://mdast.js.org/).

We get lots of benefits:

👍 The parser can take any form of XML (for example, from a saved SVG file), generate an AST and pass it over to any other patcher (for example, a virtual-dom-based one).

👍 The AST can be precompiled and loaded separately as a JS file. That would radically boost performance for complicated stuff.

👍 The patcher can take an AST generated by another parser (for example, by some non-JS plugin for Inkscape).

👍 The API will be explicit, without overloading – easier to document and understand.

I see one tradeoff there however:

👎 The learning curve will be higher. Non-programmers (designers, makers, etc) probably won’t like the API.

Perhaps I’ll leave the API as it for now – and work on the parser and generator separately. When the low-level stuff is ready, I’ll wire it up with this lib. The API here will keep its implicit, jQuery-like spirit.

I’m still open to other ideas though!

@tomek-he-him
Copy link
Member Author

Update: there is some work going on already: https://github.com/parametric-svg/ast.

@tomek-he-him
Copy link
Member Author

Moved to projectshaped/parametric-svg#21.

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

1 participant