3 ms·
I just have to whine that I have always hated the construct "convert to string". You don't convert a car to a photograph when you take a picture, and neither d
by gumby 9y ago
I just have to whine that I have always hated the construct "convert to string".
You don't convert a car to a photograph when you take a picture, and neither do you do any "conversion" when you construct a string that represents the same value as is represented by the bit pattern of your double or float.
This sounds like some weird linguistic pedantry, and perhaps it is, but I suspect this usage causes confusion for a number of beginning programmers.
- neilparikh 9y agoMaybe a better phrase would be "project to a string", similar to how taking a picture is projecting something from 3D to 2D?
- c22 9y agoHow about "transmogrify"?
- inimino 9y agoOP's complaint seems to be that "convert" suggests changing in place, which "transmogrify" suggests even more strongly.
- gumby 9y ago"Generate an X from a Y" would be both appropriate and make sense to a beginner. To me a "conversion" would have to be something like a static cast.
- yorwba 9y agoIsn't currency conversion something similar? The same value, in a different representation. Disclaimer: I'm not a native speaker and have trouble differentiating between programming jargon and normal English. Sometimes I forget strings can also be made of yarn instead of text...
- tempay 9y agoI think using "convert x to y" is linguistically okay as you're referring to a type conversion. Both x and y refer to objects which can be related to each other somehow. The same way a US plug adapter is used to convert a European plug to a American one. To (almost) keep with the analogy, it's okay to say a car was converted to a picture if it was squashed to be almost flat, framed and hung on a wall somehow. Some type conversions are highly destructive whereas others are trivial, like converting a table to a desk. To push the analogy even further I couldn't convert a car to a photograph exactly as the types are incompatable, like a float and an array (at least in most programming languages).
- ben-schaaf 9y agoIts perfectly applicable when there is no data loss in the conversion. The string "93" and the byte 01011101 are just different representations of the same piece of data. When there is data loss, I personally prefer the term "string representation"