Skip to content

Conversation

@henriquebecker91
Copy link
Contributor

Spawned by https://discourse.julialang.org/t/class-of-variables/83892

The rvalue/lvalue description does not seem benefitial. It confuse programmers that are not programming language nerds (it is a cool concept to learn, but this does not seem the place to learn it), and even programming language nerds may object. I for example, find kinda of a stretch to call ___ a lvalue because the linked wikipedia page says:

An l-value refers to an object that persists beyond a single expression. An r-value is a temporary value that does not persist beyond the expression that uses it.[3]

Considering this description, the ___ matches more a rvalue than an lvalue (even if it is semantically a location and appear always in the left-hand side of an assignment).

Spawned by https://discourse.julialang.org/t/class-of-variables/83892

The rvalue/lvalue description does not seem benefitial. It confuse programmers that are not programming language nerds (it is a cool concept to learn, but this does not seem the place to learn it), and even programming language nerds may object. I for example, find kinda of a stretch to call `___` a lvalue because the linked wikipedia page says:

> An l-value refers to an object that persists beyond a single expression. An r-value is a temporary value that does not persist beyond the expression that uses it.[3]

Considering this description, the `___` matches more a rvalue than an lvalue (even if it is semantically a location and appear always in the left-hand side of an assignment).
@KristofferC
Copy link
Member

The error message refers to them as R-values though so as long that is the case, doesn't it make sense to also have that in the documentation?

@inkydragon inkydragon added the docs This change adds or pertains to documentation label Jul 8, 2022
@henriquebecker91
Copy link
Contributor Author

Yes, I forgot to account the error message, but it just says they are not rvalues. I will change the text to at least address this point, but I find that we do not need to go defining them as lvalues as done before (as they do not retain a real location).

Added back a mention to `___` not being `rvalue`s (but nothing about them being `lvalue`s as they do not keep value nor are a real persistent location).
@KristofferC KristofferC merged commit 10961d1 into JuliaLang:master Aug 29, 2022
oscardssmith pushed a commit that referenced this pull request Aug 8, 2023
Followup to #45964, #46506, and
https://discourse.julialang.org/t/class-of-variables/83892.

The error
```
julia> println(_)
ERROR: syntax: all-underscore identifier used as rvalue
```
is hard to interpret if you are not familiar with the term `rvalue`,
which is not used in any other context in Julia, and as discussed
previously the use here is not clearly matching the wikipedia page
referred to in the documentation either.

This PR does away with the term `rvalue` by changing the error to
```
ERROR: syntax: all-underscore identifiers are write-only and their values cannot be used in expressions
```
and updates the documentation accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs This change adds or pertains to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants