#1 2023-04-18 09:45:48

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

A simple demo of mORMot + Sempare Template Engine


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2023-04-18 16:57:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: A simple demo of mORMot + Sempare Template Engine

I did not know about this Sempare template engine.
The syntax seems a bit verbose and unreadable to me, in comparison to Mustache  - once you got the Mustache way of thinking, it is very powerful.
But it is nice seeing such new code around.

Note that with the latest mormot.core.mustache versions, we can also access directly dynamic arrays or records as data source: we are not restricted to TDocVariant/JSON input data.
See e.g. https://github.com/synopse/mORMot2/blob … w.pas#L413

Offline

#3 2023-04-19 01:21:14

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: A simple demo of mORMot + Sempare Template Engine

Mustache is great, especially your Pascal implementation - it's fast.
I think the difference is that Mustache is logic-less, while Sempare template has features like for loop, sometimes it's a must-have, for example in case the logic must be written out side of Pascal/Delphi code.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2023-04-19 05:05:52

igors233
Member
Registered: 2012-09-10
Posts: 233

Re: A simple demo of mORMot + Sempare Template Engine

Yes, mustache is powerfull but sometimes it's simplicity is weak link. In some cases it requires creating new variables or additional processing on code side to achive something. I do think an additional MustacheEx or MustachemORM descendant could help in many areas and make it much more powerful.

Offline

Board footer

Powered by FluxBB