3 ms·
It's absolutely possible, yet the example doesn't do it. That's what the comment was calling out (plus a bit of superfluous "WTF").
by falcolas 6y ago
It's absolutely possible, yet the example doesn't do it. That's what the comment was calling out (plus a bit of superfluous "WTF").
- remram 6y agoWhat if you want to get the name for a hex color? Your "opinion" is just assumptions on how the data structure will be used, which you want to bake into the transmission format itself.
- falcolas 6y agoThen you're no worse off than if you had the original format. You'd have to iterate through the members in either case. That said, given there are just shy of 17 million possible RBG combinations, and a small fraction those are of named colors, I'd personally continue to optimize for the named color case.
- remram 6y agoYou should definitely optimize your data storage for the kind of operations you're going to do on them. However you're taking about the data transmission format here! Surely you wouldn't think of sending a piece of JSON over the wire with both name:color and rgb:color, regardless of whether that is what the recipient wants to operate on. You just have to let it unmarshall the data into whatever form it needs.