Re: Haskell is our first choice for building production soft...
by mehrdadn on Monday January 11, 2021 @08:01AM
(#25728307)
You probably did intend it to be a copy if you're binding it to a variable and need it to be non-const (like in the example)!
[ Parent
| on HN ]
Re: Haskell is our first choice for building production soft...
by secondcoming on Monday January 11, 2021 @08:18AM
(#25728483)
Ah, but you knew that because that's how the code was written!
If it was instead
String foo = "bar";
auto baz = foo;
you don't know for sure. But the code compiles so it obviously ok!
Re: Haskell is our first choice for building production soft...
by mehrdadn on Monday January 11, 2021 @08:22AM
(#25728521)
No, I'm saying even in that case you know it was intended to be a copy. If you wanted that to be a reference then you'd either (a) just do the obvious thing which is to just use the original variable name instead of creating a new variable out of the blue for no reason, (b) leave a comment explaining why you're not doing the aforementioned obvious thing, or (c) use a self-explanatory variable name to provide the explanation instead of a comment.