Dominic E.
1 min readFeb 21, 2019

--

Hey, thanks for your feedback. The property is not really immutable and is more like a const in JavaScript. That is, you cannot reassign the property but still mutate its value (if you really want to). Both the single underscore and the dunder do not make the property immutable per-se and I decided to use the dunder just to make it a little bit less obvious which property could be used to mutate the state of the constant. Either way would work and if I were to implement this for production I’d go with a Tensor class and also make sure the constant is really a constant and cannot be modified.

--

--

Dominic E.
Dominic E.

Written by Dominic E.

GDE for Web / @Angular • Software Engineer @StackBlitz • Trainer @thoughtram • JavaScript stuff • Node.js • Rust • Deep Learning • Cyclist • Design

No responses yet