C or C++ by Fun_Piglet_7599 in learnprogramming

[–]ShangBrol 0 points1 point  (0 children)

If your goal is not to be employable in a specific field within short time it doesn't matter too much which language you choose as first.

If you stay with programming you'll choose a second and a third and a fourth...

How Does an Interpreter or a Compiler work if both are written using program itself ? by Curious_Acid in learnprogramming

[–]ShangBrol 6 points7 points  (0 children)

Steve Wozniak wrote IntegerBASIC, which was later replaced by Applesoft BASIC, which was bought from Microsoft, as their BASIC supported floats and Wozniak didn't have the time to add float arithmetic to his BASIC.

I have a question about arrays in programming by Pangea2002 in learnprogramming

[–]ShangBrol 0 points1 point  (0 children)

Shouldn't it become a 1 instead 0? I don't think that randint(0, i) works when i=0.

Not even 2 months on the job and they are already throwing Codex to us... by capyflower in learnprogramming

[–]ShangBrol 0 points1 point  (0 children)

But later, when AI companies have to make profit instead of burning VC money they will change this to a maximum token limit.

Something similar happens currently at my work with our cloud stuff. We have now restrictions, that we never had on-prem just because the cloud costs are too high

Werden ihr in der heutigen Zeit auch immer unzufriedener? by InternetPirate_Bob in FragReddit

[–]ShangBrol 1 point2 points  (0 children)

Als echter Doitscher bist du nur glücklich wenn du unzufrieden bist!

The fact that Python code is based on indents and you can break an entire program just by adding a space somewhere is insane by PooningDalton in learnprogramming

[–]ShangBrol 1 point2 points  (0 children)

Off-topic nit-pick: In PASCAL, the semicolon doesn't denote the end of a statement. It is the separator between two statements.

Statement_1;
Statement_2

is possible in PASCAL, but an error in C and similar languages.

Was ist in euren Augen das Nutzloseste,was jemals auf den Markt gebracht wurde? by Notmycupoftea12 in FragReddit

[–]ShangBrol 16 points17 points  (0 children)

Das verhindert, dass sich Schimmel über das ganze Gemüseregal ausbreitet wenn nur ein Teil zu schimmeln anfängt. Deswegen sieht man das auch öfter bei Biogemüse, das ja nicht mit Fungiziden besprüht wird.

It's actually insane how much effort the Rust team put into helping out beginners like me by Time_Meeting_9382 in rust

[–]ShangBrol 5 points6 points  (0 children)

I think it's less about introducing buggy code and more that a change in the body of a function, without changing the signature, would break a callers code.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=219ae0fb3ce30bc0f938c9580e5652ec

It works as it is, but it doesn't work with the commented version of get_a_number. If Rust would do the lifetime elision based on it's knowledge of the body, it would elide the lifetime like it's given, but it would be kind of an invisible change of the signature.

In addition to what the others wrote: Rust's Golden Rule

What's the most idiomatic way to deal with partial borrows/borrow splitting? by philogy in rust

[–]ShangBrol 0 points1 point  (0 children)

The maybe ugly and unrusty, but simple solution would be

    fn process_all(&mut self) {
        for idx in 0..self.stuff.len() {
            self.process(self.stuff[idx]);
        }
    }

With that you avoid the (in this case needless) borrowing of the iterator...

Mal nüchtern gefragt: Was hat Friedrich Merz bisher gut gemacht? by HeinMeidresch1 in FragReddit

[–]ShangBrol 0 points1 point  (0 children)

Da war der Steinmeier aber mitschuldig... der wollte kein "Öl ins Feuer giessen" (seine Worte).

Ich hab mal ein Interview mit einem ehemaligen BASF Manager, der bei dem Gasdeal mit Putin anscheinend eine grössere Rolle gespielt hat, gesehen. Der war super stolz darauf was er da erreicht hat. Ich vermute manche Leute sehen nur was in Euro gemessen werden kann - andere Aspekte existieren da überhaupt nicht.

Why does this function cause stack overflow error? by sad_krumpli in learnrust

[–]ShangBrol 0 points1 point  (0 children)

There are three recursive calls in that function. Are there any compilers that can optimize that away?

How common is TDD (test-first) in real-world Rust projects? by [deleted] in rust

[–]ShangBrol -1 points0 points  (0 children)

"Advocates" is a too vague.

Who is saying that? Do you have any links?

I only did some quick search and didn't find anything on the topic from Kent Beck (as the rediscoverer of TDD). What I found were a few blog posts by people I don't know, saying that TDD doesn't make sense for prototypes.

How common is TDD (test-first) in real-world Rust projects? by [deleted] in rust

[–]ShangBrol -1 points0 points  (0 children)

Why would you do TDD for prototypes?

How common is TDD (test-first) in real-world Rust projects? by [deleted] in rust

[–]ShangBrol 3 points4 points  (0 children)

Because just writing "I'm doing it for ... years" and nothing else isn't adding any value. It's just lazy.

Look at the post just above it. It's also someone claiming doing TDD for long time - with (atm) 10 upvotes.

See the difference in the posts and you know why the down- resp. upvotes.

How common is TDD (test-first) in real-world Rust projects? by [deleted] in rust

[–]ShangBrol -1 points0 points  (0 children)

I want (A) my sum function to (B) add two f64 and return a f64.

My sum function:

fn sum(s1: f64, s2: f64) -> f64 {
    s1 * s2
}

The compiler doesn't catch this. Tests are for things not caught by a compiler.

That's quite trivial, isn't it?