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

asyncronous tags #15

Open
sirian opened this issue Jan 26, 2013 · 5 comments
Open

asyncronous tags #15

sirian opened this issue Jan 26, 2013 · 5 comments
Milestone

Comments

@sirian
Copy link

sirian commented Jan 26, 2013

Is it possible to add support of asyncronous tags?
for example i want to create tag "render" (like in symfony) and use it in templates like:

{% render('top_10_news_controller') %}

but controller can't immediately return data for top 10 news (for example controller gets them from database)

@soywiz
Copy link
Member

soywiz commented Jan 27, 2013

Mmm. That would be pretty hard to implement and that would be slower. At least until V8 implements generators. It would be ideal when emitting chunks of html to reduce the memory usage and provide faster responses. At this point the way to go with all template systems is to get all the async results and then pass them to the view. But I agree with you that that would be very useful. So maybe I considerer implementing it optionally (because it would be slower).

@sirian
Copy link
Author

sirian commented Jan 28, 2013

At this time as a temp solituion I can simulate sync behavior of async functions with fibers (https://github.com/0ctave/node-sync) but it would be much much slower than native async functions support.

Implementation of generators in V8 may take a lot of time (they even not realized yet iterations in harmony's Map). So I hope you will consider to implement it :)

@panosru
Copy link

panosru commented Feb 9, 2013

That would be cool but indeed would be resource consuming... :/

@soywiz
Copy link
Member

soywiz commented Mar 2, 2013

I have mostly implemented the full twig language features. I'm near to a first stable and complete release.
This feature would be great because it would allow the template to decide and to obtain lazily some data.
I wll implement it after the project reaches 1.0.

@soywiz
Copy link
Member

soywiz commented May 27, 2013

Ok. So now node v0.11.2 using --harmony supports generators, and thus async linear code.
I will modify atpl to support Promises/A, async generation and lazy data loading (just when used in templates) :)

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