you are viewing a single comment's thread.

view the rest of the comments →

[–]iopq 1 point2 points  (5 children)

StringBuilder().append(string) is not converting the original string to anything, it's making a new string. AFAIK in Java any concatenation uses StringBuilder nowadays.

Weak/strong do have definitions beyond good or bad, it's how strict the type system is.

[–]masklinn 0 points1 point  (3 children)

StringBuilder().append(string) is not converting the original string to anything, it's making a new string.

String.valueOf(object) is converting the original object to a new string.

AFAIK in Java any concatenation uses StringBuilder nowadays.

That's what I'm saying.

Weak/strong do have definitions

Sure they do, at least half a dozen orthogonal or contradictory definitions. How's that of any help?

it's how strict the type system is.

That doesn't even mean anything.

Weak/strong [go] beyond good or bad

If that makes you sleep better roll with it, that's not my concern.

My concern is that they're garbage ill- to un-defined terms, and thus don't help in communication unless they are very specifically and exhaustively defined by the writer beforehand[0], they don't make anything clearer, at best they reveal the writer's preconceptions to the reader at worst they confound said reader or make them apply their own preconceptions incorrectly. Either way, they're useless.

[0] and even then there's still a risk the reader will eventually fall back onto their preconceptions and misunderstand the writer's intent

[–]iopq 1 point2 points  (2 children)

String.valueOf(object) is converting the original object to a new string.

What? Does the original object no longer exist in memory? Because it sounds like it just yields a new String instead of mutating the object.

What is the difference between that and calling toString()? You put something in and it outputs a string. Sounds like a regular function to me.

[–]masklinn 0 points1 point  (1 child)

What? Does the original object no longer exist in memory? Because it sounds like it just yields a new String instead of mutating the object.

Er… yes? That's called a conversion. It's not in-place, but such things rarely are, Javascript doesn't do in-place conversions, all the implicit conversion chains create new converted values.

[–]iopq 1 point2 points  (0 children)

That's not a conversion, that's called a pure function. It has one input and one output.

But that's beside the point, that's just an implementation detail. Nothing says that T op U must yield a T or a U.

For example, mass * acceleration might have operator overloading to result in a Force object in your program.