How can you make a variable/Object read only in Javascript? [duplicate]

In the current widely available implementation, ECMAScript 3 there is no support for real immutability. UPDATE: Nowadays, the ECMAScript 5 standard is widely supported. It adds the Object.seal and Object.freeze methods. The Object.seal method will prevent property additions, still allowing the user to write to or edit the existing properties. The Object.freeze method will completely … Read more

what is return type of assignment operator?

The standard correctly defines the return type of an assignment operator. Actually, the assignment operation itself doesn’t depend on the return value – that’s why the return type isn’t straightforward to understanding. The return type is important for chaining operations. Consider the following construction: a = b = c;. This should be equal to a … Read more

Difference between pointer and reference as thread parameter

The constructor of std::thread deduces argument types and stores copies of them by value. This is needed to ensure the lifetime of the argument object is at least the same as that of the thread. C++ template function argument type deduction mechanism deduces type T from an argument of type T&. All arguments to std::thread … Read more

Python : When is a variable passed by reference and when by value? [duplicate]

Effbot (aka Fredrik Lundh) has described Python’s variable passing style as call-by-object: http://effbot.org/zone/call-by-object.htm Objects are allocated on the heap and pointers to them can be passed around anywhere. When you make an assignment such as x = 1000, a dictionary entry is created that maps the string “x” in the current namespace to a pointer … Read more

C++ standard: dereferencing NULL pointer to get a reference? [duplicate]

Dereferencing a NULL pointer is undefined behavior. In fact the standard calls this exact situation out in a note (8.3.2/4 “References”): Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing a null … Read more