T
tonydee
* Stefan Ram:
Not sure if I follow the above, it looks like obfuscation.
I discussed the ellipse/circle problem in my "pointers" tutorial, which is now
off-web. Perhaps I should put it on Google docs. Essentially, as you point out,
it is about an immutable-values-view versus a modifiable-variables view.
And yes, understanding it is essential for understanding the Liskov substitution
principle (contra-variance and co-variance), and it ties in with "const" in C++.
It also ties in with "in", "in/out" and "out" in languages that support such,
e.g. the partial support in C#.
Cheers,
- Alf
Hi Alf,
I would agree that the problem only arises for mutable values, but I
wouldn't agree that the problem is _about_ constness/mutability.
Still, enforced constness may be a legitimate solution, encouraging
robust usage... whether it's actually more natural and intuitive for
developers may depend upon their educational background and
experience....
I do hope you'll have time to put your articles back online....
For C++ the only such support is half hidden and
very limited, namely co-variance for pointer or reference function results.
Good point - an explicit way to mark "out" parameter would be great.
Tuples and structs help somewhat but can be clumsy.
Regards,
Tony