-
I have just started looking into bevy and I'm curious about some design choices that don't seem to be explained in the docs. Here's one regarding Line 50 in 97d8e4e What is the rationale behind this design? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Your assertions that you don't need Basically, it's like this because it's impossible for us to not require this; at least without reverting to runtime borrow checking (in the style of (Your comment about |
Beta Was this translation helpful? Give feedback.
Your assertions that you don't need
mut
to edit the value behind aBox
are false:https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=48e8e1d406dcb157dc29800d28058d0a
Basically, it's like this because it's impossible for us to not require this; at least without reverting to runtime borrow checking (in the style of
RefCell
), which would be stupid. Ideally we'd be able to tell rustc that our types are 'inherently mutable' like&mut T
, but there's no mechanism to do this in the language.(Your comment about
Rc
is weird, sinceRc
only gives immutable access to the target value, unless you usemake_mut
, but that also requires theRc
ismut
)