digitalmars.D.announce - optional 1.0.0 beta with "or/frontOr/Throw" range utilities
- aliak (27/27) Jul 29 2019 Hi,
- Aliak (2/4) Jul 29 2019 Link: https://code.dlang.org/packages/optional
- Les De Ridder (2/4) Jul 29 2019 Why not 'chain()' or 'optionalChain()'?
- aliak (2/7) Jul 30 2019 Only because chain is in range and optionalChain is too long 🤷♂...
- Andrea Fontana (2/10) Jul 31 2019 I would have voted for "optChain()"
- Jesse Phillips (3/4) Jul 30 2019 Why was it removed. It seems like this would be nice to have for
- aliak (5/9) Jul 30 2019 I personally didn't find use for it, too much friction to use. I
- Jesse Phillips (3/13) Jul 31 2019 Don't worry at this point. I still need to try out this library
Hi, After some feedback from the community [0], I'm happy to finally get the optional package to a 1.0.0 version. There is one breaking change with how pointer semantics behave, in that the previous version treated some!(int*)(null) as a non-empty optional, and some!Class(null) as an empty optional. These are both now treated as empty optionals. Compilation changes include: * orElse has been split in to "or" and "frontOr" * dispatch() has been renamed to oc(); "optional chain" * NotNull has been removed * unwrap has been removed Additions include: * frontOrThrow: if there's no front of range then it will throw. * or/frontOr work with any range, and Nullable!T. * match will resolve to void if any of the handlers return void. Added a whole bunch of "safety" checks, so CI runs with dip1000 and dip25 enabled, and uses LLVM's address sanitizer. I still don't know how to deal with auto ref return values [1] so if anyone has any tips... I'll remove the beta status after a few weeks if there're no issues. Cheers, - ali [0] https://forum.dlang.org/thread/borsieulsqyzrfaysiqu forum.dlang.org [1] https://issues.dlang.org/show_bug.cgi?id=20084
Jul 29 2019
On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:HiLink: https://code.dlang.org/packages/optional
Jul 29 2019
On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:[...] * dispatch() has been renamed to oc(); "optional chain"Why not 'chain()' or 'optionalChain()'?
Jul 29 2019
On Tuesday, 30 July 2019 at 04:18:28 UTC, Les De Ridder wrote:On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:Only because chain is in range and optionalChain is too long 🤷♂️.[...] * dispatch() has been renamed to oc(); "optional chain"Why not 'chain()' or 'optionalChain()'?
Jul 30 2019
On Tuesday, 30 July 2019 at 10:04:03 UTC, aliak wrote:On Tuesday, 30 July 2019 at 04:18:28 UTC, Les De Ridder wrote:I would have voted for "optChain()"On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:Only because chain is in range and optionalChain is too long 🤷♂️.[...] * dispatch() has been renamed to oc(); "optional chain"Why not 'chain()' or 'optionalChain()'?
Jul 31 2019
On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:* NotNull has been removedWhy was it removed. It seems like this would be nice to have for class and pointers.
Jul 30 2019
On Tuesday, 30 July 2019 at 12:58:08 UTC, Jesse Phillips wrote:On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:I personally didn't find use for it, too much friction to use. I have not gotten the impression that it's useful form others either? If people were using it I'll gladly put it back in as a subpackage or something (or just make another package).* NotNull has been removedWhy was it removed. It seems like this would be nice to have for class and pointers.
Jul 30 2019
On Tuesday, 30 July 2019 at 14:34:19 UTC, aliak wrote:On Tuesday, 30 July 2019 at 12:58:08 UTC, Jesse Phillips wrote:Don't worry at this point. I still need to try out this library with my own code, appears much nicer than nullible.On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:I personally didn't find use for it, too much friction to use. I have not gotten the impression that it's useful form others either? If people were using it I'll gladly put it back in as a subpackage or something (or just make another package).* NotNull has been removedWhy was it removed. It seems like this would be nice to have for class and pointers.
Jul 31 2019