djc / askama

Type-safe, compiled Jinja-like templates for Rust
Apache License 2.0
3.37k stars 217 forks source link

Add checking for declaration of reserved variable names (`writer` and `self`) #919

Closed PizzasBear closed 9 months ago

PizzasBear commented 9 months ago

Check for declaration of variables named writer or self when parsing a target, and error if found.

djc commented 9 months ago

Did you actually run into this? What's your use case, anyway?

PizzasBear commented 9 months ago

I didn't run into it, but I just thought it'd be useful for someone who does. The name writer could, for example, refer to the writer of a blog, and properly erroring would be helpful then.

djc commented 9 months ago

Okay, I think think this complexity has diminishing returns so I'd rather avoid this.

Kijewski commented 9 months ago

IMO that's a good addition. I don't think people will try to use self as an argument name, but I can see people stumble over the name writer.

djc commented 9 months ago

Alright, let's do it.