Skip to content
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

Non-recursive definitions #3138

Merged
merged 9 commits into from
Nov 4, 2024
Merged

Non-recursive definitions #3138

merged 9 commits into from
Nov 4, 2024

Conversation

lukaszcz
Copy link
Collaborator

@lukaszcz lukaszcz commented Oct 31, 2024

  • Closes Handling of record field names is inconsistent: different for record creation and record update #2968
  • Implements detection of function-like definitions, which either:
    • have some arguments on the left of :, or
    • have at least one clause.
  • Only function-like definitions are recursive.
  • Non-recursive definitions are not mutually recursive either, and can be used only after their definition. This necessitates rearranging some definitions in existing Juvix code.
  • Changes the scoping of identifiers in record updates. Now field names on the right side don't refer to the old values of the record fields but to identifiers in scope defined outside the record update. To refer to old values, one needs to explicitly use record projections, e.g.
r@Rec{x := Rec.x r}

@lukaszcz lukaszcz added enhancement New feature or request parsing syntax labels Oct 31, 2024
@lukaszcz lukaszcz added this to the 0.6.7 milestone Oct 31, 2024
@lukaszcz lukaszcz self-assigned this Oct 31, 2024
@lukaszcz lukaszcz marked this pull request as ready for review November 4, 2024 12:14
@lukaszcz lukaszcz requested review from janmasrovira and paulcadman and removed request for janmasrovira November 4, 2024 12:14
janmasrovira
janmasrovira previously approved these changes Nov 4, 2024
@lukaszcz lukaszcz merged commit a1037be into main Nov 4, 2024
4 checks passed
@lukaszcz lukaszcz deleted the record-fields branch November 4, 2024 15:31
janmasrovira pushed a commit that referenced this pull request Nov 4, 2024
* Closes #2968 
* Implements detection of function-like definitions, which either:
  - have some arguments on the left of `:`, or
  - have at least one clause.
* Only function-like definitions are recursive.
* Non-recursive definitions are not mutually recursive either, and can
be used only after their definition. This necessitates rearranging some
definitions in existing Juvix code.
* Changes the scoping of identifiers in record updates. Now field names
on the right side don't refer to the old values of the record fields but
to identifiers in scope defined outside the record update. To refer to
old values, one needs to explicitly use record projections, e.g.
```
r@Rec{x := Rec.x r}
```
janmasrovira pushed a commit that referenced this pull request Nov 4, 2024
* Closes #2968 
* Implements detection of function-like definitions, which either:
  - have some arguments on the left of `:`, or
  - have at least one clause.
* Only function-like definitions are recursive.
* Non-recursive definitions are not mutually recursive either, and can
be used only after their definition. This necessitates rearranging some
definitions in existing Juvix code.
* Changes the scoping of identifiers in record updates. Now field names
on the right side don't refer to the old values of the record fields but
to identifiers in scope defined outside the record update. To refer to
old values, one needs to explicitly use record projections, e.g.
```
r@Rec{x := Rec.x r}
```
janmasrovira pushed a commit that referenced this pull request Nov 4, 2024
* Closes #2968 
* Implements detection of function-like definitions, which either:
  - have some arguments on the left of `:`, or
  - have at least one clause.
* Only function-like definitions are recursive.
* Non-recursive definitions are not mutually recursive either, and can
be used only after their definition. This necessitates rearranging some
definitions in existing Juvix code.
* Changes the scoping of identifiers in record updates. Now field names
on the right side don't refer to the old values of the record fields but
to identifiers in scope defined outside the record update. To refer to
old values, one needs to explicitly use record projections, e.g.
```
r@Rec{x := Rec.x r}
```
paulcadman added a commit to anoma/juvix-arm-specs that referenced this pull request Nov 5, 2024
After the Juvix record update syntax change the Juvix stdlib must be
updated.

anoma/juvix#3138
heueristik pushed a commit to anoma/juvix-arm-specs that referenced this pull request Nov 5, 2024
After the Juvix record update syntax change the Juvix stdlib must be
updated.

anoma/juvix#3138
paulcadman pushed a commit to anoma/juvix-stdlib that referenced this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request parsing syntax
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling of record field names is inconsistent: different for record creation and record update
2 participants