icerpc/slicec

attributes vs keyword or idempotent vs oneway

Closed this issue · 1 comments

pepone commented
// a one-way operation
[oneway] opOneway(message: string)

// an idempotent operation
idempotent opIdempotent(message: string) -> int32

What is the reason to use a keyworkd for idempotent and an attribute for oneway, conceptually they seem to be at the same level.

It's all about the contract: idempotent is part of the contract whereas oneway isn't.

https://docs.testing.zeroc.com/slice2/language-guide/operation#idempotent-operation

idempotent or no idempotent must in-sync (or mostly in-sync) in your client and server.

That's not the case for oneway: the server doesn't care at all about the oneway attribute in its Slice definitions. It receives the "oneway" information with the request, and presumably can deal (at runtime) with a request sent oneway or twoway.