←back to thread

498 points azhenley | 1 comments | | HN request time: 0.401s | source
Show context
gethly ◴[] No.45769775[source]
Variable is by definition mutable.

Constant is by definition immutable.

Why can't people get it through their heads in 2025? (I'm looking at you, Rust)

replies(4): >>45769884 #>>45769977 #>>45770214 #>>45770314 #
witx ◴[] No.45770314[source]
A constant is a variable that _always_ has the same value on all lifecycles, e.g.

    const int a{10};
An immutable variable well ... does not

   void some_function(const int a);
Can you tell me what is the value of `a` on both cases?
replies(2): >>45772835 #>>45775686 #
1. pasteldream ◴[] No.45775686[source]
I’m not sure why witx’s comment was downvoted. This is absolutely the standard usage in math and computer science.