logoalt Hacker News

mgaunardlast Monday at 10:31 AM1 replyview on HN

members of a const struct are also const.

Now you obviously can still have escape hatches and cast the const away whenever you want.


Replies

wtetznerlast Monday at 11:08 AM

> members of a const struct are also const.

Yes, but if your struct contains references, the constness doesn't apply to what those references point to. In Rust it does.

show 1 reply