DConf2016 Livestream questions

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed May 4 10:23:01 PDT 2016


(moved from the old 2015 thread)

On 5/4/16 5:44 PM, Jack Stouffer wrote:
 > On Thursday, 28 May 2015 at 00:54:30 UTC, Andrei Alexandrescu wrote:
 >> John Colvin's experiment is great and we want to make it a full
 >> success. Please post here feedback and suggestions for tomorrow's
 >> DConf streaming. Thanks! -- Andrei
 >
 > The chat for UStream is sporadic and mostly broken.
 >
 > I wanted to ask Steven a question and I don't have a twitter, so I
 > wanted to use the integrated chat, but it had serious problems loading.
 > Once it did load, when I posted something it would tell me my post
 > failed to be sent.
 >
 > My question for Steve:
 >
 > "Can I use inout to make a length function for a range that is
 > automatically const if the underlying data/range's length function is
 > const? It would need to go all the way down for composed ranges."

Sorry this didn't get asked, but here is the answer:

No :)

The problem is that if the underlying range does not support const or 
inout, then when the type itself is inout, the subtype will be inout, so 
we cannot call functions that aren't marked properly. Remember when 
inside an inout function, you don't know what the unwrapped mutability 
modifier actually is.

Here is the problem however, ranges are pretty useless if they are not 
mutable. So this really isn't something that's super-important to solve. 
Do you have a specific use case?

-Steve


More information about the Digitalmars-d mailing list