-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is let
referentially transparent?
#1371
Comments
let
's value succeed determine how it may be used?let
referentially transparent?
I think I recall this being discussed recently, with some movement towards "no" -- I wonder if you recall and could summarize any of that here @josh11b ? (Or apologies if I've misremembered...) |
We have decided that the value phase of However, I believe there are still open questions, including whether In addition the question from #996 is still open, though the resolution above makes it a distinct question. What remains to be determined is when you write |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the |
#2360 resolves this: the |
#2153 allows implicit conversion between symbolic and template value phases, as long as the source is known to satisfy the constraints on the target. However, I have heard that we don't want to extend this to conversion from a runtime value to a compile-time value. This would mean that I'm not aware of anywhere else documenting that decision. I propose we resolve this question with this issue, selecting the first option: value expressions may not be converted from runtime phase to any compile-time phase. |
From a discussion in #typesystem started on 2022-07-06, a question arose about this code:
We are considering two options here:
x
is considered a runtime r-rvalue because it was declaredlet x: ...
instead oflet x:! ...
, then the callF(x)
would be forbidden.x: T
or anx:! T
can be used in a:!
context depends on whether (symbolic) evaluation of the expression containingx
succeeds or not, regardless of howx
was declared, and that:!
is a constraint only on how the value is provided, not on how it's used. In other words, the callF(x)
may or may not be allowed depending on...
.In this second case,
F(if b then x else y)
may not care about the properties ofx
depending on the value ofb
.Note that deferred question-for-leads issue #996 asks a related question about whether a
let
is referentially transparent under specific conditions.The text was updated successfully, but these errors were encountered: