Skip to content

Refactor short circuiting identifiers - #1439

Merged
Alasdair merged 1 commit into
sail2from
and_or_bool
Sep 9, 2025
Merged

Refactor short circuiting identifiers#1439
Alasdair merged 1 commit into
sail2from
and_or_bool

Conversation

@Alasdair

@Alasdair Alasdair commented Sep 8, 2025

Copy link
Copy Markdown
Collaborator

The short-circuiting operators are quite special, but previously they were just identifiers with special names Id "and_bool". Now they have their own constructors in the id_aux type (And_bool/Or_bool), so they can easily be identified in the semantics without any kind of string comparison.

Probably they should have been expressions like E_short_circuit, but that would be a much bigger refactor. Might be worth doing though.

This is the first step in a simplification of identifier handling. Currently the operator ++ could be Id "++" or Operator "++" depending on where it is. Plan is to remove E_app_infix and just use E_app with an attribute indicating if it was desugared from an infix form. Then having Operator x always for operators and Id x for C-style identifiers.

@Alasdair

Alasdair commented Sep 8, 2025

Copy link
Copy Markdown
Collaborator Author

Additional points:

  • Having and_bool and or_bool as special identifiers does make them work seamlessly with the overloading mechanism, which wouldn't be the case for an expression constructor like E_short_circuit.

  • Question of how append_id and prepend_id should work. With this PR they raise an error if used to manipulate and_bool/or_bool. They are both slightly broken with infix operators anyway, but are usually not used to manipulate function identifiers so this isn't an issue in practice.

@github-actions

github-actions Bot commented Sep 8, 2025

Copy link
Copy Markdown

Test Results

   15 files     33 suites   0s ⏱️
  957 tests   954 ✅  3 💤 0 ❌
4 695 runs  4 658 ✅ 37 💤 0 ❌

Results for commit fad4f72.

♻️ This comment has been updated with latest results.

@Alasdair
Alasdair merged commit 0f20f02 into sail2 Sep 9, 2025
17 checks passed
@Alasdair
Alasdair deleted the and_or_bool branch September 9, 2025 13:43
jn80842 pushed a commit to GaloisInc/sail that referenced this pull request Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant