Conversation
# Conflicts: # cache.go # cache_test.go # go.mod # policy.go # ttl.go # z/z.go
# Conflicts: # cache.go
|
Thank you for the PR @aryehlev. I do agree that not having zeroValue function is useful but at the same time, I do not like using named return. It reduces the readability of the code. Is there a way we could have both? |
|
@mangalaman93 hey, the point was to get rid of zeroValue. |
|
An alternative is to do this at the top of the function and then return that value.... var value V
...
value = ....
....
return value, errI tend to use this pattern extensively when writing generic Go code. +1 on not using blank returns. |
Doing this is same as what we have today, don't you think? |
|
@mangalaman93 closing PR. |
When i added generics in my PR i put the zerovalue to return valid values(since not all values will have nil).
a more elegant solution is just to have paramater returns in the function
Checklist
CHANGELOG.mdfile describing and linking tothis PR
docs repo staged and linked here
Instructions
syntax, leading with
fix:,feat:,chore:,ci:, etc.link to the bug.
[x]syntax.back and check the box later.
Instructionsline and everything below it, to indicate you have read and arefollowing these instructions. 🙂
Thank you for your contribution to Ristretto!