News for hackers. Stuff that matters.
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by boxed on Monday October 06, 2025 @03:02AM (#45488411)
Aside from technical factors, there are social factors involved. For example, both Python and C++ has operator overloading. But in C++ that's horrible and you run screaming from it, while in Python land it's perfectly fine. What is the difference? Culture and taste.
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by HelloNurse on Monday October 06, 2025 @03:41AM (#45488674)
It isn't the same operator overloading.

In C++ operator overloading can easily mess with fundamental mechanisms, often intentionally; in Python it is usually no more dangerous than defining regular functions and usually employed purposefully for types that form nice algebraic structures.

Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by pjmlp on Monday October 06, 2025 @07:10AM (#45490090)
I hardly see the difference, given the capabilities of operator overloading in Python,

    class MyNum(int):
        def __add__ (self, other):
            return super().__add__(other) * 10
        
        
    n = MyNum(12)
    a = 45
    print(n + a) # oops
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by HelloNurse on Monday October 06, 2025 @07:53AM (#45490382)
This type confusion would have been identical with a plain function, __add__ is only syntactic sugar:

    class MyNum(int):
        def ten_times_sum (self, other):
            return (self+other)* 10

    n = MyNum(12)
    a = 45
    print(n.ten_times_sum(a)) 
Compare with, for example, fouling the state of output streams from operator>> in C++.
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by pjmlp on Monday October 06, 2025 @08:30AM (#45490641)
Hardly any different, trying to pretend Python is somehow better.

Operator overload is indeed syntactic sugar for function calls, regardless of the language.

By the way, you can overload >> in Python via rshift(), or __rshift__() methods.

Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by HelloNurse on Monday October 06, 2025 @09:22AM (#45491138)
Of course I can overload >> in Python, but I cannot foul up output stream state because it doesn't exist. Formally there is little difference between C++ and Python operator overloading and both languages have good syntax for it, but C++ has many rough edges in the standard library and intrinsic complications that can make operator overloading much more interesting in practice. For instance, overload resolution is rarely trivial.
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by pjmlp on Monday October 06, 2025 @09:31AM (#45491241)
It is only one pip install away, if anyone bothers to make on such set of overloads.
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by boxed on Tuesday October 07, 2025 @05:02AM (#45500911)
People don't though. That's the big difference. There's a certain taste in the Python community.
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by boxed on Monday October 06, 2025 @07:43AM (#45490306)
It's the exact same thing except in Python the community largely has taste. In C++ `cout >> "foo"` exists in the standard library.
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by quotemstr on Monday October 06, 2025 @11:15AM (#45492312)
I love how among a certain set the word "taste" has become an all-purpose substitute for having an argument or making a case. It basically means "I have more social media follows than you do, so I'm right"
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by boxed on Tuesday October 07, 2025 @08:36AM (#45502346)
I believe the C++ community as a whole are quite convinced that overloading >> for stdout was a mistake.
Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by quotemstr on Monday October 06, 2025 @11:13AM (#45492294)
> Culture and taste.

You mean accumulated prejudices, myths, and superstitions that most in any given community (programming language related or not) won't challenge for fear of being cast out of the group for heresy.

Re:Should I choose Ada, SPARK, or Rust over C/C++? (2024) by boxed on Tuesday October 07, 2025 @05:02AM (#45500914)
Err... no I mean the good taste not to overload >> for console output. There's no fear of being cast out, don't be silly.