New names - 2.068 roundup

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 25 06:41:09 PDT 2015


On 6/24/15 11:40 PM, Adam D. Ruppe wrote:
> On Thursday, 25 June 2015 at 03:12:47 UTC, Steven Schveighoffer wrote:
>> A curious thing though. All the tests for things like:
>>
>> assert(setExtension("file", "ext") == "file.ext");
>>
>> do not trigger a call to eager.
>
> But it passes? That's bizarre. (My dmd is apparently too old to compile
> this, it segfaults when I try!)

Let me clarify this -- it does not spout the deprecation for those 
lines. I'm not sure exactly what the compiler is doing :) is there a 
good way to determine how the compiler is resolving the call?

>
>> assert(setExtension("file", "ext").array == "file.ext");
>
> I did experience this in my proof-of-concept because I didn't implement
> .length. So when array checked hasLength, it found it through the alias
> this, which called eager.

Hm... it should only define length if the underlying strings satisfy 
hasLength. And AFAIK, strings and wstrings do not have length according 
to Phobos. I can do some asserts to check.

> (That's also why I did a foreach loop instead
> of just returning array(this). Well, that and the auto-decode nonsense,
> but array would be a recursive call and stack overflow anyway).

I actaully followed Walter's example and used std.conv.to :)

> These two things are weird, but I'm sure they're just bugs that we can
> handle. In the morning, I'll try a git dmd and see if I can play with it
> a little, right now I'm just guessing since it won't build on my current
> setup.

I'm interested to hear how it goes!

-Steve


More information about the Digitalmars-d mailing list