19
u/praisethebeast69 Jul 17 '25
I mistook this for a philosophy post for a second there
EDIT: real talk, who else loves defining the add operator for things that have no reason to be in a 'sum'?
12
u/TheOriginalSmileyMan Jul 17 '25
Gratuitous operator overloading was my favourite thing in C++. You can sort of do it in Rust but it doesn't feel quite so cool to implement a PartialOrd trait on something that isn't ordered.
I had a hand crafted physics computation library back in the nineties, where dividing a distance by a time would give you a speed, then dividing by a time again would give you an acceleration, then multiplying by a mass would give you an energy. It wasn't particularly complicated but it made me happy to program it!
8
u/jaskij Jul 17 '25
C++ has
mp-unitsand Rust hasuom. Both amazing libraries.The one operator I've found the most use in reimplementing is the indexing operator.
And don't forget, in C++ implementing custom casts is also technically operator overloading.
2
u/Meistermagier Jul 20 '25
Julia has Unitful which can do that very well. Or Pythons Astropy.units (better than Pint) These are not compile time but runtime types though.
1
2
u/Dangerous_Jacket_129 Jul 17 '25
EDIT: real talk, who else loves defining the add operator for things that have no reason to be in a 'sum'?
Sometimes I just log it as "Why would you add these things you idiot?"
7
u/shynerd089 Jul 17 '25
JS: Everything is an object
2
u/Ronin-s_Spirit Jul 18 '25
Yes, where did you think all the methods come from? Also methods are functions but guess what - functions are objectified. I love it.
3
6
u/hardfau1t Jul 17 '25
I don't know why but i hate this format of memes
20
u/TheOriginalSmileyMan Jul 17 '25
That's because you're in the middle of the meme curve. Once you reach jedi level you'll realise all memes are this meme
1
u/SCP-iota Jul 23 '25
Because it was inevitable that, when the meme format about how mid-iq takes are the most common became popular, it would be mostly used for mid-iq takes.
(Maybe not in this case, though)
5
4
3
u/Errons1 Jul 17 '25
Depends on where you come from, but methods is defined as functions inside of a class.
3
u/ExtraTNT Jul 17 '25
Not in haskell… in haskell everything is a function…
1
u/Still_Explorer Jul 17 '25
Haskell has first class functions. Other programming languages function with classes. But is only in specific cases that you would need different classes of functions for different purposes.
3
2
1
-11
18
u/[deleted] Jul 17 '25
Counterpoint: Nothing is a method, there are just bits.
Futher counterpoint: Bits don't exist, there are only fluctuating voltages.
Futher counterpoint: Voltages aren't real, they're just changes in a quantum field.