Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
dear c++ experts, dear rust experts, what is unsafeCoerce in those languages?
unsafeCoerce
ah, i guess you can do reinterpret_cast<T&> in c++. but does that really not generate any code?
reinterpret_cast<T&>
rednaZ said:
In rust it's std::mem::transmute
std::mem::transmute
But I would say unsafeCoerce is slightly safer, because it assumes LiftedRep type representation (basically, normal data constructors), while transmute operates on any type with any representation, which is closer to unsafeCoerce# primop
LiftedRep
transmute
unsafeCoerce#
dear c++ experts, dear rust experts, what is
unsafeCoerce
in those languages?ah, i guess you can do
reinterpret_cast<T&>
in c++. but does that really not generate any code?rednaZ said:
In rust it's
std::mem::transmute
But I would say
unsafeCoerce
is slightly safer, because it assumesLiftedRep
type representation (basically, normal data constructors), whiletransmute
operates on any type with any representation, which is closer tounsafeCoerce#
primop