-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add recursive Let-bindings #525
Comments
Yes. The current plan is to require an explicit Having said that, I personally am in favor of explicit |
rules_haskell was written entirely without recursion, just maps and folds. So yeah, I buy that recursion is not that useful. I've updated the title and description accordingly to push for |
Is your feature request related to a problem? Please describe.
There is no way currently to define recursive functions using let-binding alone. One has to work around this using records. Example:
Describe the solution you'd like
Add
let-rec
, so that the following works:Alternatively, we could make all let-bindings recursive (see below).
Describe alternatives you've considered
We could alternatively make all let-bindings recursive. However, for most use cases of a configuration language, recursive let-bindings should be rare, if needed at all. Further, there is a cost to recursive let-bindings. Code that would fail at scope checking time could instead be unintentionally recursive. It also makes shadowing the same variable repeatedly in a chain of let-bindings not work the way some users would expect, e.g.
let x = 1 in let x = x + 1 in x
would need to be rewritten aslet x = 1 in let x' = x + 1 in x'
.A downside of explicit recursion is that it's not consistent with records, which are implicitly recursive.
The text was updated successfully, but these errors were encountered: