0.15.1 Reader/Writer

Thanks, I think I understand it now.
Tbh, only because I worked through “Crafting Interpreters” and getting my hands dirty by implementing a language from scratch.

Still, as an application developer, it feels natural to not use a local variable for the reader, when all I’m interested in is one of its attributes, in this case, “interface”. This could even be called best practice (I don’t have a strong opinion about this).

If what feels natural is actually wrong, that’s a big footgun.

My feeling is that it’s somehow against the philosophy of the language of making it easy to write correct code.

Maybe the word “interface” should ring the alarm bell, when found in a Zig program: “Don’t use it without a dot in front of it, and never copy it, not even its address”.

Maybe a linter or the complier should emit a warning when it finds this kind of usage.

7 Likes