(1/2) One problem with zero-cost abstractions (I'm primarily thinking about , but other things qualify too — e.g. macros and inline functions in C) is that they are hard to reverse engineer (that includes writing a decompiler). By definition, abstractions are zero-cost when high-level semantics get compiled away and don't result in a different code compared to a manual low-level implementation.

(2/2) Furthermore, some things in higher-level languages are "descriptive not prescriptive", e.g. Rust lifetime specifiers and Java generics (that work via type erase at compile time), that only serve to enforce internal invariants of the high-level code and so don't influence the generated machine code at all.

That also makes me think a comparison to Java generics may help people grok lifetimes, because a common confusion among Rust beginners is

"what do these <'a> &'a things in function signatures actually _do_?"

The answer is that they, much like Java generics, don't change/influence what your code compiles to, but let/help you enforce type/memory safety.

@bugaevc You could make an argument that in most cases it's not a disadvantage because you're generally not supposed to decompile stuff. 😄

@YaLTeR well, as someone who works by day in a company that specializes in decompilation & static analysis, and by night hacks on a project to reverse engineer/recreate Apple software... 😀

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!

We adhere to an adapted version of the TootCat Code of Conduct and follow the Toot Café list of blocked instances. Ash is the admin and is supported by Fuzzface as a moderator.

Hosting costs are largely covered by our generous supporters on Patreon – thanks for all the help!