←back to thread

498 points azhenley | 2 comments | | HN request time: 0.011s | source
Show context
Razengan ◴[] No.45770236[source]
If designing your hypothetical ideal language, what are some intuitive/cute keywords you would choose for mutables/immutables?

`let` is so 2020. `const` is too long. `static` makes me fall asleep at the keyboard. `con` sounds bad. How about

`law`?

    law pi = 3.142 (heh typing on Mac autocompleted this)

    law c = 29979245

    law law = "Dredd"
or `set` or `once` or `make`?
replies(4): >>45770286 #>>45771270 #>>45771607 #>>45779782 #
tomaytotomato ◴[] No.45770286[source]
There was a proposal in Java a few years back to introduce "val".

I think it never gained traction but it would have been nice to have this in Java

    val firstName = "Bob";
    val lastName = "Tables";
    var fullName = "";

    fullName = firstName + " " + lastName;
replies(2): >>45770383 #>>45770702 #
Razengan ◴[] No.45770702[source]
That's an aesthetically awkward and also bug-prone syntax: So just a difference of 1 single letter (that looks similar) to mean the completely opposite thing?? Nah you don't want that, and I don't either.
replies(2): >>45770891 #>>45772233 #
1. dionian ◴[] No.45772233[source]
They're intuitively named. A value is a value. A variable is a variable.
replies(1): >>45772541 #
2. Razengan ◴[] No.45772541[source]
A variable is also a value.