rinja-rs / rinja

A template rendering engine based on Jinja, generating type-safe Rust code at compile time.
https://rinja.readthedocs.io
Apache License 2.0
28 stars 4 forks source link

Add support for `..` in let pattern matching for structs (alternative take) #36

Closed Kijewski closed 1 week ago

Kijewski commented 1 week ago

This is an alternative solution to implement rest patters .. for struct or tuple targets. I think this implementation is a little bit easier to read and understand. I hope it's OK that I opened a new PR!

Closes #35.

GuillaumeGomez commented 1 week ago

Yes no problem. Your code is SO MUCH better, thanks a lot! Just some nits and suggestions for better error messages but it's really details at this point.

Kijewski commented 1 week ago

Your code is SO MUCH better, thanks a lot!

Thank you! I loved compiler construction during my studies, and I'm always happy when I find an excuse to still dabble into that field nowadays.

Just some nits and suggestions for better error messages but it's really details at this point.

Yes, I think good error messages make all the difference. It's a meme that rust tells you with subpixel accuracy where your mistakes are and how to fix them, and we should embrace it. :)

GuillaumeGomez commented 1 week ago

Your code is SO MUCH better, thanks a lot!

Thank you! I loved compiler construction during my studies, and I'm always happy when I find an excuse to still dabble into that field nowadays.

Glad you're enjoying it! 😄

Just some nits and suggestions for better error messages but it's really details at this point.

Yes, I think good error messages make all the difference. It's a meme that rust tells you with subpixel accuracy where your mistakes are and how to fix them, and we should embrace it. :)

Definitely! askama's great, but error messages were terrible. I'm glad things improved to this point already. We can still do better and I think we will!

GuillaumeGomez commented 1 week ago

Great work, thanks a lot!