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

PDF cleanup 282: hide use of open for records in pdf #364

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

williamdemeo
Copy link
Collaborator

Description

Hide use of open for records in pdf. This addresses one item of issue #282.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • Code is formatted according to CONTRIBUTING.md
  • Self-reviewed the diff

Copy link
Collaborator

@WhatisRT WhatisRT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open can't just be hidden from view, since it carries a lot of meaning. For example, in EPOCH it does some of the actual work. Rather, we should use techniques that avoid using open in the code, like for example pattern-matching on a state/environment when defining rules, instead of binding it to a single name and then writing open State s. Another option would be to use some kind of deep accessors to avoid nested opens and then applying those deep accessors to our variables. What's right needs to be decided on a case-by-case basis.

instead try using accessors; not as pretty, but avoids exposing some `open` declarations
@williamdemeo
Copy link
Collaborator Author

Okay, I tried being less aggressive about hiding open statements, especially when applied to a private variable. I'm now hiding some open statements without naming the private variable, using accessors to make it more clear what's happening.

@williamdemeo williamdemeo force-pushed the william/282-remove-open-for-records branch from 12c3635 to 751187e Compare February 19, 2024 03:21
-- ^ this rolls over the future enact state into es
open LState ls; open UTxOState utxoSt; open CertState certState
open PState pState; open DState dState; open GState gState
open Acnt acnt

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed a couple of instances of open for records here, at the expense of using accessors below.

@@ -110,13 +111,13 @@ data _⊢_⇀⦇_,GOV'⦈_ where
(Γ , k) ⊢ s ⇀⦇ sig ,GOV'⦈ addVote s aid voter v

GOV-Propose : ∀ {x} → let
open GovEnv Γ; open PParams pparams hiding (a)
open GovEnv Γ
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove one instance of open for record pparams at the expense of having to write pparams a couple of times below.

@@ -44,6 +44,8 @@ record LState : Set where

txgov : TxBody → List (GovVote ⊎ GovProposal)
txgov txb = map inj₁ txvote ++ map inj₂ txprop
\end{code}
\begin{code}[hide]
where open TxBody txb
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem necessary to show this open directive in the figure.

open RwdAddr
open DState
open CertState
open CertState; open DState; open LEnv; open LState; open RwdAddr; open TxBody
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove five instances of open for records from the figure at the expense of lots explicit use of accessors in the LEDGER transition rule below. Is it worth it? Is there a better way to avoid the open directives here?

Comment on lines 72 to 74
⦃ DecEq-PolicyId : DecEq PolicyId ⦄
⦃ DecEq-AssetName : DecEq AssetName ⦄
⦃ DecEq-Tot : DecEq (AssetId ⇒ ℕ) ⦄
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these really need to appear in the figure?

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.

2 participants