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

Add client methods to interfaceClient template #285

Merged
merged 11 commits into from
Aug 5, 2022

Conversation

lthibault
Copy link
Collaborator

As discussed on Matrix, commonly-used Client methods are not accessible from subtypes of Client.

This PR adds the following methods to the interfaceClient template:

  • client.String
  • client.Resolve
  • client.SetFlowLimiter

It also adds docstrings to existing methods.

@zenhack What are your thoughts the other methods (WeakRef, State, IsSame, ...)? I can't quite decide whether it makes sense to export these. Are they deliberately part of the public API, or are they intended for internal use, but originally exported out of necessity?

@lthibault lthibault requested a review from zenhack August 5, 2022 14:06
Copy link
Contributor

@zenhack zenhack left a comment

Choose a reason for hiding this comment

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

Re: other methods:

  • IsSame() definitely makes sense.
  • I feel ambivalent about State(); it's such a rarely used thing that having to cast to Client might actually be good to keep it out of the namespace for "normal" uses.
  • I think WeakRef makes sense, but also I think we should make WeakClient a generic type (type WeakClient[T ~ClientKind]) if we're going to do that (and also get rid of the pointer indirection like we did with Client. Probably enough stuff be a separate PR.

capnpc-go/templates/interfaceClient Outdated Show resolved Hide resolved
capnpc-go/templates/interfaceClient Outdated Show resolved Hide resolved
@lthibault lthibault requested a review from zenhack August 5, 2022 20:52
@lthibault
Copy link
Collaborator Author

Agreed for WeakRef. Leaving that for a separate PR.

Copy link
Contributor

@zenhack zenhack left a comment

Choose a reason for hiding this comment

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

Almost there.

capnpc-go/templates/interfaceClient Outdated Show resolved Hide resolved
capnpc-go/templates/interfaceClient Show resolved Hide resolved
@lthibault lthibault requested a review from zenhack August 5, 2022 21:35
@zenhack zenhack merged commit b987519 into main Aug 5, 2022
@lthibault lthibault deleted the bugfix/re-export-cap-methods branch August 5, 2022 23:59
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