ecorm / cppwamp

C++ client library for the WAMP protocol.
Boost Software License 1.0
35 stars 9 forks source link

Replace Client overloads with fluent API #7

Closed ecorm closed 9 years ago

ecorm commented 9 years ago

If an optional "details" parameter is added to Client operations, the combination of optional parameters will result in many overloads. For example:

call(procedure, handler);
call(procedure, args, handler);
call(procedure, details, handler);
call(procedure, args, details, handler);

The above overloads could be replaced by a single fluent API:

call( Rpc("foo")
    .withArgs({42})
    .withKwArgs({{"bar",false}})
    .withBlacklist({12345678})
    .andDiscloseMe(),
    handler );

This mechanism might also be used to unify the CoroClient and CoroErrcClient APIs under the same class.