• 0 Posts
  • 4 Comments
Joined 3 years ago
cake
Cake day: January 29th, 2024

help-circle

  • While my comment is about c++, not c, I did learn about one use case where rust is strictly worse than c++. Unbelievably low latency applications. Such as software that trades stocks. The way it’s implemented, is by sharing memory addresses across code intentionally having the same address written to and read from across threads. Something rust is sort of designed to not support.

    It’s the only use case I know of where that’s true.


  • Okay, I do think this makes you sound crazy.

    I’m putting my question first before I rant about this cause I think I got way more into this response than is warranted.

    What problem does this design of just creating bespoke functions have that your design solves?

    def mean(numbers):
        return efficient calculation
    def normalization(numbers):
        return efficient calculation
    def geometric_mean(numbers):
        return efficient calculation
    
    

    Rant starts here:

    With your design, every time someone wants an average of a set of numbers, you’re reimplementing the actual logic. Then if someone forgets the +1 and writes:

    quotient_reduce(sum, lambda x,y: x, numbers)
    

    A bug is introduced that’s hard to spot in a review, won’t give an error, and is hard to write tests for. Turning the lambda to an enum meant to be passed around would solve a some of the accidental bugs, but keeps the interaction with the function more complicated.

    I really just don’t understand why you wouldn’t just write each efficient implementation as it’s own function and call it directly.


  • The big things are the deli counter and vibe of the place. Things aren’t necessarily super over priced like chain convenient stores. They also often also tailor to more specific customers. There is one near me that has shelves of Indian products while another just a block away carries Polish products.