Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-27 Thread aliak via Digitalmars-d-announce
On Monday, 27 August 2018 at 05:22:30 UTC, FeepingCreature wrote: - Consider a short form for "dispatch". Purely for convenience: e.g.: john.d.residence.d.numberOfRooms; Why not .get, like Nullable? As long as you never alias it to this... ;) Mmm... get is indicative of getting the value.

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-26 Thread FeepingCreature via Digitalmars-d-announce
- Consider a short form for "dispatch". Purely for convenience: e.g.: john.d.residence.d.numberOfRooms; Why not .get, like Nullable? As long as you never alias it to this... ;)

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-24 Thread Paul Backus via Digitalmars-d-announce
On Friday, 24 August 2018 at 20:59:34 UTC, aliak wrote: THis is true. And might be interesting to try out actually. Can you access the types in a SumType via index? I'm thinking because Optional behaves like a range, and I guess I'd define a SumType!(T, None), then a rough outline may be:

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-24 Thread aliak via Digitalmars-d-announce
On Wednesday, 22 August 2018 at 22:49:52 UTC, Paul Backus wrote: On Wednesday, 22 August 2018 at 22:11:05 UTC, aliak wrote: On Monday, 20 August 2018 at 19:52:53 UTC, jmh530 wrote: It's interesting that both sumtype and optional have match templates. Maybe scope to combine these projects?

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-22 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 22 August 2018 at 22:11:05 UTC, aliak wrote: On Monday, 20 August 2018 at 19:52:53 UTC, jmh530 wrote: It's interesting that both sumtype and optional have match templates. Maybe scope to combine these projects? That'd be cool. Optional uses .match on a "some" or "none" range,

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-20 Thread jmh530 via Digitalmars-d-announce
On Monday, 20 August 2018 at 19:06:36 UTC, Seb wrote: [snip] That looks pretty cool! I added optional to run.dlang.io (e.g. https://run.dlang.io/is/912kVG) and the project tester (https://github.com/dlang/ci/pull/288). It's interesting that both sumtype and optional have match templates.

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-20 Thread Seb via Digitalmars-d-announce
On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm [...] That looks pretty cool! I added optional to run.dlang.io (e.g. https://run.dlang.io/is/912kVG) and the project tester (https://github.com/dlang/ci/pull/288).

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-20 Thread aliak via Digitalmars-d-announce
On Monday, 20 August 2018 at 09:16:18 UTC, ikod wrote: On Thursday, 16 August 2018 at 16:20:09 UTC, aliak wrote: On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: It's also @nogc and @safe No it's not. Not dispatching at least. Dunno why though. Seems safey is because taking an

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-20 Thread ikod via Digitalmars-d-announce
On Thursday, 16 August 2018 at 16:20:09 UTC, aliak wrote: On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: It's also @nogc and @safe No it's not. Not dispatching at least. Dunno why though. Seems safey is because taking an address. Nogc will have to look in to. Hello! please,

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-17 Thread aliak via Digitalmars-d-announce
On Friday, 17 August 2018 at 06:59:48 UTC, Petar Kirov [ZombineDev] wrote: On Thursday, 16 August 2018 at 18:10:38 UTC, jmh530 wrote: On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm I've totally revamped the Optional type and am now quite happy

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-17 Thread Petar via Digitalmars-d-announce
On Thursday, 16 August 2018 at 18:10:38 UTC, jmh530 wrote: On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm I've totally revamped the Optional type and am now quite happy with. It has a range interface and safe dispatching and can be used to 1) avoid

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-16 Thread jmh530 via Digitalmars-d-announce
On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm I've totally revamped the Optional type and am now quite happy with. It has a range interface and safe dispatching and can be used to 1) avoid null dereferencing, 2) have non-null guarantees, and 3)

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-16 Thread aliak via Digitalmars-d-announce
On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: It's also @nogc and @safe No it's not. Not dispatching at least. Dunno why though. Seems safey is because taking an address. Nogc will have to look in to.

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-16 Thread aliak via Digitalmars-d-announce
On Thursday, 16 August 2018 at 15:38:50 UTC, Paul Backus wrote: On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm Looks great! auto john = some(new Person()); Would it also work to leave off the `some` here and skip the first `dispatch` in the

Re: Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-16 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 16 August 2018 at 12:25:14 UTC, aliak wrote: Hi See: https://optional.dub.pm Looks great! auto john = some(new Person()); Would it also work to leave off the `some` here and skip the first `dispatch` in the following lines? (i.e., make `john` a `Person` rather than an

Optional and NotNull version 0.5.0 - swift optional like and scala option like

2018-08-16 Thread aliak via Digitalmars-d-announce
Hi See: https://optional.dub.pm I've totally revamped the Optional type and am now quite happy with. It has a range interface and safe dispatching and can be used to 1) avoid null dereferencing, 2) have non-null guarantees, and 3) show clear intent where there may or may not be a value.