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

Should Rpc, Procedure, Pub, Topic and friends have converting constructors? #60

Closed
ecorm opened this issue May 6, 2015 · 3 comments
Closed
Labels
Milestone

Comments

@ecorm
Copy link
Owner

ecorm commented May 6, 2015

Should Rpc, Procedure, Pub, Topic and friends have converting constructors? For instance, Rpc has an explicit constructor taking a string for the procedure name. By making the constructor non-explicit, it would make it more convenient to call RPCs.

For example, instead of

session->call(Rpc("foo"), yield);

You could simply do:

session->call("foo", yield);

However, as soon as you need to specify arguments or options, you'd have to use explicit construction:

session->call(Rpc("foo").withArgs({42}), yield);
@ecorm
Copy link
Owner Author

ecorm commented May 12, 2015

I think with C+11 list initialization, you could simply do this:

session->call({"foo"}, yield)

I need to test it out to make sure. If that's indeed the case, then the constructors should stay explicit.

@ecorm ecorm added this to the v0.4.0 milestone May 12, 2015
@ecorm
Copy link
Owner Author

ecorm commented May 12, 2015

I tried the above a got a compiler error.

@ecorm
Copy link
Owner Author

ecorm commented May 12, 2015

I'm going ahead and changing these constructors to implicit. This will not break the current API.

@ecorm ecorm modified the milestones: v0.3.1, v0.4.0 May 12, 2015
@ecorm ecorm closed this as completed in 74dfe5c May 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant