-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Automatic compilation #17
Labels
enhancement
New feature or request
Comments
Preliminary work in commit 10abb62. |
noteflakes
added a commit
that referenced
this issue
Apr 21, 2024
noteflakes
added a commit
that referenced
this issue
Apr 21, 2024
noteflakes
added a commit
that referenced
this issue
Apr 21, 2024
noteflakes
added a commit
that referenced
this issue
May 8, 2024
noteflakes
added a commit
that referenced
this issue
May 8, 2024
noteflakes
added a commit
that referenced
this issue
May 9, 2024
noteflakes
added a commit
that referenced
this issue
May 9, 2024
noteflakes
added a commit
that referenced
this issue
Jan 9, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compilation right now works only partially, and is based on Ruby's internal AST representation. This does have the advantage of being able to compile dynamically generated templates, but is not a very friendly API, nor is it well documented or guaranteed to be stable over the long run.
Over the long run, the Ruby ecosystem will come together around Prism, and that's why I'm working on Sirop, a complementary gem that builds on top of Prism.
So the idea is to build a compiler on top of Sirop (a big part of the functionality is already there in the test DSL compiler).
This issue is for tracking progress on this undertaking.
Still to be implemented:
text
emit
with textemit
with procemit
with templateemit
with proc/template (with additional arguments)emit_yield
defer
emit_markdown
def_tag
_for
for direct iteration (https://github.com/digital-fabric/papercraft?tab=readme-ov-file#direct-iteration)JIT compilation
We want compilation to be automatic and transparent. Say, on the second call to
#render
for a specific template, the template is automatically compiled and the compiled code is memoized. From then on, rendering will actually use the compiled proc.For naked procs, we can memoize the compiled version in some ivar under
Papercraft
, e.g.Papercraft.__compiled_proc_cache__
.Next steps
The text was updated successfully, but these errors were encountered: