Porting std.typecons to Phobos 3
Paul Backus
snarwin at gmail.com
Sun Nov 17 12:08:14 UTC 2024
On Sunday, 17 November 2024 at 03:13:20 UTC, Jonathan M Davis
wrote:
> e.g. in the case of Nullable [...] adding the ability to cast
> to bool in addition to using hasValue (or whatever we call the
> replacement for isNull)
https://github.com/dlang/phobos/pull/9039
> and adding the ability to dereference it (that way, it can be
> used in if conditions just like a pointer, and templated code
> could work with either pointers or Option/Maybe/Whatever ).
I don't think this is a great idea. Option!T has value semantics
(w.r.t. the T value), but T* has reference semantics, so generic
code that tries to work with both will likely fall into the same
pitfalls that code using input ranges currently does.
> Personally, it's on my todo list to sit down and look through
> how Rebindable and friends need to be reworked, since that's
> kind of a mess, and some of it is potentially going to affect
> how we deal with ranges.
Mathis Beer/FeepingCreature did a bunch of work on this,
including a DConf talk [1]. Might be worth getting in touch with
him.
[1] https://www.youtube.com/watch?v=eGX_fxlig8I
More information about the Digitalmars-d
mailing list