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

Removing superfluous refcap ceremony from example #4169

Closed

Conversation

redvers
Copy link
Contributor

@redvers redvers commented Aug 2, 2022

Where:

  class ProcessClient is ProcessNotifynew iso create(env: Env) =>
  ⋮

The following ceremony in Main isn't required:

    let client = ProcessClient(env)
    let notifier: ProcessNotify iso = consume client

It can more clearly be expressed as:

  let client: ProcessClient iso = ProcessClient(env)

Where:

```pony
  class ProcessClient is ProcessNotify
  ⋮
    new iso create(env: Env) =>
  ⋮
```

The following ceremony in Main isn't required:

```pony
    let client = ProcessClient(env)
    let notifier: ProcessNotify iso = consume client
```

It can more clearly be expressed as:

```pony
  let client: ProcessClient iso = ProcessClient(env)
```
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Aug 2, 2022
@@ -21,8 +21,7 @@ use "files"
actor Main
new create(env: Env) =>
// create a notifier
let client = ProcessClient(env)
let notifier: ProcessNotify iso = consume client
let client: ProcessClient iso = ProcessClient(env)
Copy link
Member

Choose a reason for hiding this comment

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

well, why bother with the : ProcessClient iso?

that can go as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept it for two reasons:

  1. The original did it.
  2. If someone is reading the example then they have to look in one of three places to realize that ProcessMonitor takes a ProcessNotify iso.
  • ProcessClient.create()
  • The ProcessMonitor.create function signature, or
  • The ProcessMonitor callsite in the example (and infer that the consume likely means it was originally an iso).

For somebody unfamiliar with the package - I wanted that to be explicit.

If you'd still rather lose the definition I can lose it, but that is why I chose to be explicit in this case.

@SeanTAllen
Copy link
Member

SeanTAllen commented Aug 2, 2022

I think the commit comment for this should be changed. This doesnt at the moment remove any refcap ceremony. It removes an unneeded variable. With my noted change, it could remove an unrequired type annotation and an not needed variable.

Either way, the commit message (and PR title) should be adjusted.

@@ -32,7 +31,7 @@ actor Main
// create a ProcessMonitor and spawn the child process
let sp_auth = StartProcessAuth(env.root)
let bp_auth = ApplyReleaseBackpressureAuth(env.root)
let pm: ProcessMonitor = ProcessMonitor(sp_auth, bp_auth, consume notifier,
let pm: ProcessMonitor = ProcessMonitor(sp_auth, bp_auth, consume client,
Copy link
Member

Choose a reason for hiding this comment

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

also, not sure why we are doing : ProcessMonitor here. We have some annotations on some and none on others. I think we should either have none or all for the example, not this in between state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, you know that my preference is to annotate everywhere - (especially in docs where the purpose is to communicate as easily as possible).

The pony style-guide doesn't mention omitting types and refcaps on variable definitions so I didn't consider that to be an overriding concern...

Copy link
Member

Choose a reason for hiding this comment

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

Then I would say, annotations for all here. And updates to commit message (if you update first message here and pr title, they can be used on squash).

@SeanTAllen SeanTAllen removed the discuss during sync Should be discussed during an upcoming sync label Aug 30, 2022
@SeanTAllen
Copy link
Member

@redvers I'm going to close this as it hasn't gone anywhere.

@SeanTAllen SeanTAllen closed this Jan 29, 2024
@ponylang-main ponylang-main added discuss during sync Should be discussed during an upcoming sync and removed discuss during sync Should be discussed during an upcoming sync labels Jan 29, 2024
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.

3 participants