HN user

ndotl

106 karma

[ my public key: https://keybase.io/jiawen; my proof: https://keybase.io/jiawen/sigs/42nvI6zbZw99tutHkVnrQS9GF6szdbWGOPKnKsOemKo ]

Posts1
Comments5
View on HN
Keyringless GnuPG 7 years ago

To me, this is another example of functional vs object oriented styles of programming.

signify is essentially a pure function. It carries no state and the output is purely a function of its inputs (and a bunch of internal constants).

GnuPG (and indeed music players) are stateful. To some, it may be irritating to build up that state to do something simple. OTOH, that state is useful if it's a cache hit and it's annoying to repeatedly pass the same parameters (i.e., you want to repeatedly do a bunch of ops against the same identity you've imported).

It's usually easier to write a functional core and wrap it in something stateful (by currying the arguments) rather than the trying to do the reverse as the author is doing here.