Tag Info

New answers tagged

1

I am really surprised nobody pointed this out. Answer: It would not benefit you significantly, even if it was mutable. It would not benefit you as much as that causes additional trouble. Let's examine two most common cases of mutation: Changing one character of a string Since each character in a Java string takes either 2 or 4 bytes, ask yourself, would ...


1

There are certain things that cannot be considered separately. In other words, there are certain things that are not orthogonal at all. Firstly, think about how your type system will allow the implementation of pure functions. A pure function shouldn't care about whether the inputs are values, ref's, or other pure functions that promise to provide the same ...


0

they sometimes behave as they were the same type, and sometimes they don't, without explicit conversions (which is one of the reasons why references are used in the first place). No they don't. An int & (basically an int lvalue) can be implicitly converted to an int (an rvalue), but not the other way around.


0

If you are trying to decide what you should do in a language you are designing, I would suggest providing syntactical forms programmers can use to indicate various expectations. As a hypothetical example (borrowing concepts from a few languages): let x = someValue; Create a new read-only identifier x, and expect that any code which can ever see the new ...


3

C++ treats int, const int, int&, and const int& as separate types with ways to convert to/from each type (except to const int or to const int&). If you know what types you have and what types are expected, then given a list of converters, you know if you can make each passed parameter pass as an argument parameter. Since there may also be ...



Top 50 recent answers are included