Hacker News new | ask | show | jobs
by jswrenn 623 days ago
Author, here! Happy to answer any questions.
2 comments

Is there a possibility you could change the title of the post to something relevant to its content? HN unfortunately has a policy against providing useful titles to links when page authors haven't done so themselves, and the intersection of people who will want to read your post and people who are interested in late medieval personal protective equipment is probably pretty low.
sadly, i clicked on it specifically because I was curious what PPE was available in the time of alchemy. what i found was boring code instead. 100% click-bait-n-switch
Me too! I mean I might be interested in object transmutation in Rust some of the time but not right now. Likely there are even more people in the converse situation, but they aren't the ones commenting on this thread.
HN policy also suggests using a representative phrase when the main title is misleading[1]; in this case the subtitle (The Path Towards Safer Transmute) seems suitable. (This can be changed either by the OP or by someone who bothers to email the moderators.)

[1] https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...

I'd love an explanation of how bool bit validity causes undefined behavior. Does the compiler emit "jump if equal to 1" instructions instead of "jump if equal or above 1" when comparing operands?
UB has nothing to do with what the compiler emits. It's undefined behavior because the language says it's undefined behavior.

That said, "what may happen in practice" can be an interesting question, but any answer cannot be relied on to be the case, because it may change at any time. Looks like my sibling already gave you a possible thing that may happen.

The reserved values can be used as tags in outer enum types. For example `Option<bool>` might encode `None` as 2. If you did `Some(transmute::<bool>(2))` it'd turn into `None`.