I use this often, but there is one typical scenario where I break this rule - creation commands. Often someone calling a command that creates an entity needs the ID of whatever was created. Yes, you can use UUIDs and pass this to the creation function (or use more complex methods), but I haven't really come across scenarios where this adds anything meaningful, not to mention that it's not always possible. So I generally break CQS for creation commands, i.e. they change state and return a value.
EDIT: I just noticed the Wikipedia article cites other examples, e.g. The `pop()` method on a Stack.
AKA Command-query Separation (CQS)
https://en.wikipedia.org/wiki/Command%E2%80%93query_separati...
I use this often, but there is one typical scenario where I break this rule - creation commands. Often someone calling a command that creates an entity needs the ID of whatever was created. Yes, you can use UUIDs and pass this to the creation function (or use more complex methods), but I haven't really come across scenarios where this adds anything meaningful, not to mention that it's not always possible. So I generally break CQS for creation commands, i.e. they change state and return a value.
EDIT: I just noticed the Wikipedia article cites other examples, e.g. The `pop()` method on a Stack.