Dlist and dip1000 challenge

Walter Bright newshound2 at digitalmars.com
Fri Oct 26 10:17:50 UTC 2018


On 10/25/2018 2:12 PM, Steven Schveighoffer wrote:
> What I can't figure out is why I'm passing a string to the allocation function, 
> which is allocating a new node on the heap containing the string, but it seems 
> to want to say this should be scope. Both the string and the new node shouldn't 
> be scope.

Can you boil this down to the minimum?


> If rampant dip1000 cheating is happening like in dlist, then making phobos 
> compile isn't the complete answer IMO.

My intent is for it to work without cheating.


> I'm OK with the PR you linked, I just have no idea how to review it, as I'm not 
> a DMD developer.

One of my ongoing goals is to make DMD easier to understand. Unfortunately, when 
it does get easy, people then feel comfortable adding complexity until it is no 
longer understandable. I suspect this is one of those immutable laws like the 
Peter Principle:

   https://en.wikipedia.org/wiki/Peter_principle

I.e. all software is doomed to be incomprehensible. I'll still struggle against 
that, though :-) Currently I've been doing some refactoring to replace Visitor 
traversals with switch statements. I find the latter much simpler to understand, 
for the simple (!) reason that it has no dependency on an external thing like 
the Visitor base class.


> The concept seems specific to Phobos, and a little kludgy, but 
> if it moves things forward, I'd be OK with it. The only thing that seems really 
> strange to me is that `return` is not the return.

I tried to make it as narrow as I could (restricted to the first argument) to 
see if that works well enough. If it does, great. If it doesn't, it can be 
expanded later, which is much easier than trying to narrow it.

The other thing about it is it is purely additive, so there's no risk of 
breaking existing code. I.e. it's low risk.



More information about the Digitalmars-d mailing list