News for hackers. Stuff that matters.
Re:Nim Programming Language v0.15.0 released by nnq on Saturday October 01, 2016 @05:31AM (#12617184)
Imperative code benefits a lot in readability and maintainability if it follows some kind of CQS pattern ( https://en.wikipedia.org/wiki/Command%E2%80%93query_separati... , http://martinfowler.com/bliki/CommandQuerySeparation.html ). Never used Nim but its `discard` keyword seems to nudge people in this direction.

Yeah, looking at it from the perspective an utopical pure functional world this seems as much of an abomination as "out arguments" in C# ...but in real world code things look different :)

Re:Nim Programming Language v0.15.0 released by qwertyuiop924 on Saturday October 01, 2016 @06:21AM (#12617272)
CQS is neat, but return values on imperative functions are really useful. For one thing, it allows you to compress your API, have an action that can be used solely for the side effect, or for the value of that expression. In addition, you can use it to determine success or failure, and other important information about the function.