3 ms·
I'm sort of hoping someone forks Go to provide at least a few single-depth generics like Optional/Maybe, to match Map and Slice.
by gertef 13y ago
I'm sort of hoping someone forks Go to provide at least a few single-depth generics like Optional/Maybe, to match Map and Slice.
- rybosome 13y agoIf it had been done at the very beginning, I think it would have been wonderful...but given that legal, idiomatic nil is already out in the wild I think it's too late. Such a shame - in the example of error handling, returning an Option doesn't appreciably increase verbosity: _, err := potentiallyErroringOperation() // with idiomatic nil if err != nil {...} // with monadic Option if err.isDefined() {....} EDIT: fix typo
- dragonwriter 13y agoSomeone's already provided a template processor for/in Go that provides generics. https://github.com/droundy/gotgo https://github.com/droundy/gotgo