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

prevent accidental misuse of if-else #449

Closed
untitaker opened this issue Nov 6, 2024 · 3 comments · Fixed by #450 or #462
Closed

prevent accidental misuse of if-else #449

untitaker opened this issue Nov 6, 2024 · 3 comments · Fixed by #450 or #462

Comments

@untitaker
Copy link

i had this template in my code:

@if condition { path_a }
else { path_b }

maud rendered this to:

path_a
<else>path_b</else>

it would be nice if maud could make all of its own constructs reserved keywords, so that this situation doesn't occur anymore. there shouldn't be a reason to ever create an <else> tag. if there is, surely new syntax like "else" { .. } can satisfy that usecase.

@puetzp
Copy link
Contributor

puetzp commented Nov 12, 2024

I regularly forget to add @ in front of maud keywords too, so I like the suggestion.

However I would propose to only merge a pull request that implements this if it does not come with a noticeable performance hit during compilation. I appreciate the fast compilation speed of maud templates immensely (the template engine I used prior to maud was an order of magnitude slower) and the smooth programming experience that comes with it.

That being said, I think I will take a stab at this when I find the time.

Edit:

It probably just needs to be added here.

@lambda-fairy
Copy link
Owner

lambda-fairy commented Jan 6, 2025

@puetzp It's very unlikely that a parser change would have a noticeable impact on build time. Most of the slowness of proc macros comes from generating too much code, or a one-off cost from compiling syn.

@lambda-fairy lambda-fairy reopened this Jan 7, 2025
@lambda-fairy
Copy link
Owner

#450 was done on the old parser, which has since been replaced. I'll redo it on the new parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants