kainjow/Mustache

Compile-time parsing

patlecat opened this issue · 5 comments

I was wondering if your parsing is really compile-time? If not, then you may want to consider to use constexpr for example or other ways to make sure of it is since the mustache syntax won't change during runtime (obviously).

You may also consider using the excellent and insanely fast header-only fmt lib (soon in C++20), that would be awesome then I won't have to convert strings all the time with my code.
https://github.com/fmtlib/fmt

Example of a compile-time regex lib: https://github.com/hanickadot/compile-time-regular-expressions

Why do you think it’s compile time? That claim is not made anywhere. Curious to know where you saw that.

You could write a subset of mustache for compile time but you couldn’t implement features like lambdas which allow rendering any text dynamically.

I’m not understanding your comment about converting strings. Can you provide an example?

@kainjow Yeah I didn't mean you made that claim, I was wondering if it is compile-time or not? But okay it's not as you said. But then partial use of constexpr would still make sense, don't you think?

Forget about the converting of fmt, I meant just to use it to format and handling strings (including conversions to/from strings). After all the processing of mustache should be as fast as possible.

I think what would maybe be more beneficial is to use string_view once it’s available since that would reduce copies.

string_view is available since C++17, or what do you mean with once it's available?

Ah, nice. I was thinking it wasn't available yet anywhere. Cool, I'll look into it.