Skip to content
Discussion options

You must be logged in to vote

Hi @lo1tuma, I have some responses below:

In comparison to JavaScript I don’t think there is a huge difference regarding safe mutations. One big disadvantage in JavaScript is that by default mutations are always possible unless someone explicitly freezes the value, so mutations are implicitly always allowed. I think it can be compared to Swift when inout would be an implicit default behavior.

Mutable-by-default is not the only problem with JS objects, and in fact it's kinda the least pernicious. The real problem with JS objects is that they are reference types, and so that when you do mutate them, that mutation is visible to everyone holding a reference and you can never know who mutate…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@mbrandonw
Comment options

@maksimn
Comment options

@lo1tuma
Comment options

@mbrandonw
Comment options

Answer selected by lo1tuma
@lo1tuma
Comment options

@tgrapperon
Comment options

@Alex293
Comment options

@mbrandonw
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants