New Diet template engine almost complete, ready for comments
Sönke Ludwig via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Mon Jul 25 22:54:39 PDT 2016
Am 26.07.2016 um 05:22 schrieb Puming:
> On Monday, 25 July 2016 at 09:29:38 UTC, Sönke Ludwig wrote:
>> The Diet template language is aimed at providing a way to define
>> procedurally generated HTML/XML pages (or other output formats), with
>> minimal visual noise. Syntax and feature set are heavily inspired by
>> Jade <http://jade-lang.org/>, but instead of JavaScript, all
>> expressions and statements are D statements, and everything that can
>> be done at compile-time is done at compile-time.
>>
>> [...]
>
> A feature I want the most for Diet is the ability to parse Diet
> templates at RUNTIME instead of compile time with a switch, similar to
> Regex/CtRegex.
>
> In this way one can do quick turnarounds in dev mode, tweaking little
> corners of the pages, and then when a page is finished, it can be
> switched to compile mode for faster render time.
>
> Do you think this is feasible?
A real runtime solution would require a D runtime interpreter or JIT
compiler. There would be an alternative solution based on compiling each
template to a shared library and then dynamically recompiling/reloading
those as required, but that currently doesn't work due to the alias
parameter based interface of render!(...).
However, what should work well is a combination of
https://github.com/dlang/dub/pull/446 and
https://github.com/rejectedsoftware/vibe.d/pull/1385 - I'll merge the
latter one into vibe.d master today. It will require to store session
information and similar things in an external store, and on Linux the
Gold linker should be used for speed, but then it should be almost as
good as a runtime solution.
More information about the Digitalmars-d-announce
mailing list