http://d.puremagic.com/issues/show_bug.cgi?id=7177
--- Comment #24 from Steven Schveighoffer <[email protected]> 2013-03-21 10:14:53 PDT --- (In reply to comment #22) > Because if you don't, then you can never use $ when slicing a range. This is extreme. You certainly CAN use $ with ranges that support $. > And really, isRandomAccessRange should require that $ work with finite ranges > for > the same reason. As it stands, you pretty much can't use $ in generic code. > It's only good for arrays, because you can't count on it working for anything > else. Yes you can, it just requires the range supports $. Define supportsDollar trait. Done. > The appropriate range templates must be able to require them for us to be > able to use them, and if we change them to require opDollar without this > enhancement request, then it's going to break a lot of code. Then don't change them. Requiring $ is as simple as defining a trait that checks for $ support. There is no reason slicing has to be predicated on having an end point. And having an end point does not require having a length (see strings) and is not necessarily an integer value equivalent to the length. If, for example, we add requiring $ for isRandomAccessRange, and then have a function that requires a random access range but doesn't use $, what is the benefit of doing that? Either you need $ or you don't, and that is quantifiable with a separate trait. Support for slicing or indexing is a precondition for having $ but $ is not required in order to slice or index. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
