Post B4eYdfVRk7qaOM7AZs by m0xEE@nosh0b10.m0xee.net
 (DIR) More posts by m0xEE@nosh0b10.m0xee.net
 (DIR) Post #B4eQI8OEsFY1y8xq3E by m0xEE@nosh0b10.m0xee.net
       0 likes, 0 repeats
       
       This is example from The Rust Programming Language book demonstrating operator overloading.Okay, I get it they needed a simple structure with a couple of fields to demonstrate the… ehm, point. But operator overloading is what you do when you want to make something feel more natural and… what's the mathematical meaning of adding one point to another? AFAIR in geometry you don't do that — you can add two vectors starting in the point of origin and ending at specified coordinates, you can subtract pairs of coordinates and find the lenght of the resulting vector to learn the distance, but this makes no sense — you dont add points to each other per se!It would make more sense if it was Drink { rum: i32, cola: i32 } or Basket { mushrooms: i32, potatoes: i32 }. Of course one can figure out that Point is just a pair of coordinates here, then name it Coord or Displacement and leave x and y be — now that feels natural, adding points just feels weird 🥴
       
 (DIR) Post #B4eYdfIgVZdfkm8yga by condret@fedi.absturztau.be
       0 likes, 0 repeats
       
       @m0xEE vectors, points, the difference between those things is irrelevant to the code that runs on your puter, it's often the same data structure. so why care?
       
 (DIR) Post #B4eYdfVRk7qaOM7AZs by m0xEE@nosh0b10.m0xee.net
       0 likes, 0 repeats
       
       @condret@fedi.absturztau.beYou're right, from the point of data they are just tuples. It's about the context: they are explaining operator overloading, plus in the example, so they should be using things adding which to one another would seem natural, mixing drinks having different ingredients would feel intuitive, but their example to me was like: adding… points, WTF? 🤔 Oh, I see…While typing my post I stumbled upon this: https://math.stackexchange.com/questions/645672/what-is-the-difference-between-a-point-and-a-vectorSome insist that in linear algebra, it would be okay to add points because they are the same from the point of data and then get into semantics.After reading that and realising that I'm not the first one to run into this, I even wanted to discard my post and then pressed submit by accident 😂But now that I think about it, even if some consider adding points okay, my point still stands: it's okay to say: "There is something behind that bush, probably a wolf",— if it turns out a dog, no one would be surprised. You can even say: "It's just a big dog",— explaining wolf to a child, but when you are using dog for wolf in a textbook explaining different concept, it still feels out of place — using broader term like "canine" would probably be better.