New names - 2.068 roundup
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 25 06:45:54 PDT 2015
On 6/24/15 11:40 PM, Adam D. Ruppe wrote:
> (An interesting point here though is since alias this DOES return a
> string, any duck-type checks or implicit conversion checks will also
> pass what it passes... and work, it'll just silently allocate the
> string. Which is no regression! The status quo is it allocates that
> string EVERY time anyway. But it also isn't ideal. Someone earlier said
> we can probably apply @nogc to everything but the eager method. I think
> that'd work, and then at least the allocations wouldn't be silent
> anymore - the @nogc attribute at the call site can catch them.)
One thing that is troubling to me here is that doing an alias this to a
string presents 2 range interfaces, but they are not "atomic". That is,
something that is checking for elements of a range may find some
properties satisfy by using the alias this, and other properties satisfy
using the real type. For example, it would be alarming if it called
r.eager.length to get the length, but then used the chainString to
actually do a slicing operation. For this case, it's probably fine, but
I never considered that alias this can present a "hybrid" between both
types that may satisfy more than you want.
An interesting drawback for alias this...
-Steve
More information about the Digitalmars-d
mailing list