On 11/16/15 11:03 AM, Steven Schveighoffer wrote:
On 11/14/15 10:44 AM, Andrei Alexandrescu wrote:

That doesn't work for me with my unittests, I get:


I'm such an idiot, I depended on dpaste to run the unit test, but forgot
to check the unit test button.

So technically, my updated version *parses* correctly :)

Looking in more depth...


I can't get your original code to work, so it's hard for me to figure out what is wrong. Using 2.069.1, I have the following error (after factoring out `either`, which I'm assuming is a new function):

Stevens-MacBook-Pro:testd steves$ dmd -unittest persistent_list.d
/Users/steves/.dvm/compilers/dmd-2.069.1/osx/bin/../../src/phobos/std/conv.d(4161): Error: template std.conv.emplaceImpl!(const(Node)).emplaceImpl cannot deduce function from argument types !()(const(Node), immutable(int), const(Node)*, int), candidates are: /Users/steves/.dvm/compilers/dmd-2.069.1/osx/bin/../../src/phobos/std/conv.d(3932): std.conv.emplaceImpl!(const(Node)).emplaceImpl()(ref UT chunk) /Users/steves/.dvm/compilers/dmd-2.069.1/osx/bin/../../src/phobos/std/conv.d(4037): std.conv.emplaceImpl!(const(Node)).emplaceImpl(Args...)(ref UT chunk, auto ref Args args) /Users/steves/.dvm/compilers/dmd-2.069.1/osx/bin/../../src/phobos/std/conv.d(5087): Error: template instance std.conv.emplace!(const(Node), immutable(int), const(Node)*, int) error instantiating persistent_list.d(169): instantiated from here: emplace!(const(Node), immutable(int), const(Node)*, int)
persistent_list.d(195):        instantiated from here: opBinaryRight!"~"
persistent_list.d(266):        instantiated from here: List!(immutable(int))

However, examining the code, I think you don't even need inout here, just a const function will do fine, since nothing on the original is changing, and all your nodes are flavored as pointing to const nodes.

I see you have updated the code, and that doesn't work for me either.

I'm afraid without a working example, I can't figure out what's *supposed* to work with inout/const.

-Steve

Reply via email to