ssbc / ssb-bfe

Binary Field Encodings (BFE) for Secure Scuttlebutt (SSB)
3 stars 1 forks source link

Cosmetic refactors related to if/else #24

Closed staltz closed 3 years ago

staltz commented 3 years ago

Context: in PR #22, arj asked to bring back the else if pattern.

The first commit formats the encoder / decoder object so that:

The second commit does the else-if refactor

staltz commented 3 years ago

@mixmix Could you check this one?

mixmix commented 3 years ago

I don't see the else if as an improvement, but won't block this.

I mainly like the horizontal alignment of all the clauses and the lack of vertical spread (this adds 20 lines?)

If this started with If (false) If else (x) return... If else (y) return...

Then it would be aligned. Dunno if linter let's you collapse those blocks into single line though

mixmix commented 3 years ago

Basically this PR feels like minor safety improvement vs minor readability improvement (for some). Ie bikeshed!

Let's keep moving

staltz commented 3 years ago

I don't see the else if as an improvement, but won't block this.

I think it's more about keeping the else if pattern that was there in ssb-bfe originally