Re: Is Nullable supposed to provide Optional semantics?

2018-01-13 Thread Chris Paulson-Ellis via Digitalmars-d-learn
On Saturday, 30 December 2017 at 19:11:05 UTC, Steven Schveighoffer wrote: Please file a bug report. Sorry for the delay - stuff happened. I reopened an existing bug that I found: https://issues.dlang.org/show_bug.cgi?id=17440

Re: Is Nullable supposed to provide Optional semantics?

2017-12-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/30/17 3:59 AM, Chris Paulson-Ellis wrote: On Friday, 29 December 2017 at 22:08:59 UTC, vit wrote:     n = Nullable!Object.init;     assert(n.isNull == true); [...] more: https://forum.dlang.org/thread/jrdedmxnycbqzcpre...@forum.dlang.org?page=1 Thanks. No-one in the linked thread see

Re: Is Nullable supposed to provide Optional semantics?

2017-12-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, December 30, 2017 08:59:40 Chris Paulson-Ellis via Digitalmars- d-learn wrote: > On Friday, 29 December 2017 at 22:08:59 UTC, vit wrote: > > n = Nullable!Object.init; > > assert(n.isNull == true); > > > > [...] > > more: > > https://forum.dlang.org/thread/jrdedmxnycbqzcpre...@f

Re: Is Nullable supposed to provide Optional semantics?

2017-12-30 Thread Chris Paulson-Ellis via Digitalmars-d-learn
On Friday, 29 December 2017 at 22:08:59 UTC, vit wrote: n = Nullable!Object.init; assert(n.isNull == true); [...] more: https://forum.dlang.org/thread/jrdedmxnycbqzcpre...@forum.dlang.org?page=1 Thanks. No-one in the linked thread seemed to know why .destroy is used in nullify. Looki

Re: Is Nullable supposed to provide Optional semantics?

2017-12-29 Thread vit via Digitalmars-d-learn
On Friday, 29 December 2017 at 21:43:25 UTC, Chris Paulson-Ellis wrote: On Friday, 29 December 2017 at 21:34:27 UTC, vit wrote: use: n = Nullable!Object.init; //doesn't call destroy instead of: n.nullify(); Only nullify() can make isNull return true again. I need that semantic.

Re: Is Nullable supposed to provide Optional semantics?

2017-12-29 Thread Dukc via Digitalmars-d-learn
On Friday, 29 December 2017 at 21:43:25 UTC, Chris Paulson-Ellis wrote: Only nullify() can make isNull return true again. I need that semantic. Quick idea without much afterthought: instead of Nullable, use pointer to o?

Re: Is Nullable supposed to provide Optional semantics?

2017-12-29 Thread Chris Paulson-Ellis via Digitalmars-d-learn
On Friday, 29 December 2017 at 21:34:27 UTC, vit wrote: use: n = Nullable!Object.init; //doesn't call destroy instead of: n.nullify(); Only nullify() can make isNull return true again. I need that semantic.

Re: Is Nullable supposed to provide Optional semantics?

2017-12-29 Thread vit via Digitalmars-d-learn
On Friday, 29 December 2017 at 20:52:51 UTC, Chris Paulson-Ellis wrote: I've been bitten by trying to use Nullable(T) on class types. Minimal example... [...] use: n = Nullable!Object.init; //doesn't call destroy instead of: n.nullify();

Is Nullable supposed to provide Optional semantics?

2017-12-29 Thread Chris Paulson-Ellis via Digitalmars-d-learn
I've been bitten by trying to use Nullable(T) on class types. Minimal example... import std.typecons : Nullable; void main() { auto o = new Object(); o.toString(); Nullable!Object n = o; o.toString(); n.nullify(); o.toString(); // SegV! } The SEGV is caused by nullify