Persistent list

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 16 08:58:43 PST 2015


On 11/15/15 2:09 PM, Andrei Alexandrescu wrote:
> On 11/13/2015 06:10 PM, Andrei Alexandrescu wrote:
> [snip]
>
> Thanks all for the feedback. I've uploaded an updated version to
> http://dpaste.dzfl.pl/52a3013efe34. It doesn't use "inout", but doesn't
> duplicate code either; instead, it relies on private internal functions
> to do the deed.

This still doesn't compile for me.

> While revising feedback I realized I'd missed Steve's version that works
> with inout: http://dpaste.dzfl.pl/3fbc786a50c1. It works and the
> inout-related parts don't look difficult; the only thing is making sure
> the right incantations are in place, and that's the difficult part.

I would say the difficult part is figuring out the incantations from the 
given error messages. When you are depending on something to compile 
because it can call a template function, it's often difficult to figure 
out where it went wrong. The error messages are frequently unhelpful.

inout is actually pretty simple to use. It has a couple of severe 
limitations that make it difficult to work with in certain situations -- 
one of them being composition (you can't compose a type with inout 
members). We can work on fixing these problems.

> So one important question is what style we use for Phobos and endorse as
> idiomatic. My sense after working on this for a while is - forget inout.
> Qualifiers are rather complex, and of them inout is the most. So I'd
> rather marginalize it. Please chime in with any thoughts.

I disagree. inout is no more complex than const in most cases. In my 
experience changing to inout is simply changing the term "const" to 
"inout", and everything pretty much works. This was my experience when 
updating dcollections after inout was finally made to work.

I'm going to work on writing an article about inout. It frequently 
confuses the shit out of everyone who uses it, and I don't think it should.

-Steve


More information about the Digitalmars-d mailing list