pretzelhammer / rust-blog

Educational blog posts for Rust beginners
Apache License 2.0
7.11k stars 380 forks source link

A potential tweak to common-rust-lifetime-misconceptions #27

Closed scottmcm closed 3 years ago

scottmcm commented 3 years ago

Great post! I've needed a link for some of these before (number 11 is the most recent one I remember needed).

One nuance you might consider adding to misunderstanding 4 -- people might be conflating "generics" and "monomorphization" in their mind. So they'd be correct that it's possible to avoid monomorphization, just incorrect that it's possible to avoid generics.

pretzelhammer commented 3 years ago

people might be conflating "generics" and "monomorphization" in their mind.

They might be, but since the target audience of my posts are Rust beginners I wouldn't expect them to be making this conflation. I could add a clarifying note like "btw, generics aren't the same thing as monomorphization, which is avoidable" but I think most readers would find that more confusing than clarifying because I'm casually introducing an advanced concept like monomorphization without any warning or explanation. I think it's okay to leave as-is, intentionally omitted.

With that said, I would like to write an article in the future called something like Polymorphism in Rust where I go over things like static dispatch, dynamic dispatch, monomorphization, trait objects, etc.

I'm currently soliciting advice, ideas, and direction for future articles so if you have any opinions on the matter please let me know in the linked discussion thread!