I'm pretty sure one of the biggest differences between C# and Java is that in C# you can't assume everything is a reference. A strict is passed by value.
Re:C++ Papercuts
by fluoridation on Monday August 28, 2023 @10:24AM
(#37294505)
No, strings are passed by reference, it's just that the string type is immutable. Passing a string to a function doesn't create a copy, but there's also no way for the callee to modify the object that the caller points to.
It is true that C# has value types that are by default passed by copy, though.
I mistyped struct as strict.
Java or Python would have been a better example, as that isn't the case with C#.
Re:C++ Papercuts
by lelanthran on Monday August 28, 2023 @09:23AM
(#37293563)
> Use a decent IDE.
When I'm navigating code, the references aren't a problem, because I am using an IDE of some sort, usually.
The complaint I made was about reading, not navigating, for example when reviewing a PR.
Use a decent IDE that allows you to review PRs from within the IDE.
Java and c# are both pass by value (c# has optional ref that must be annotated at both the call site and definition, it also has value structures).
Class types are effectively pointers that are passed by the value of the pointer.
You cannot implement swap in Java without eg wrapping the params in one element arrays.
I find this all a bit rich anyway. In languages like C#, everything is a bloody reference and this lame concept of "reference types" corrupts developer minds.