DirEntry isDir not working?

Jonathan M Davis jmdavisProg at gmx.com
Mon Feb 25 16:56:02 PST 2013


On Monday, February 25, 2013 21:29:28 monarch_dodra wrote:
> Since you are the one that refactored, what was the point of
> those _init functions? Wouldn't they have better worked as
> private constructors?

It's the way that it's always been, but I don't currently remember the details 
of why I made which changes I made and not others. I suspect that it was done 
that way, because the code that used the explicitly created them before it 
initialized them, and I guess that whoever wrote it originally didn't like the 
idea of doing something like

de = DirEntry(args);

but I don't know. It's on old module (probably from D1 originally) and has a 
fair bit of work done on it, but that doesn't mean that no quirks have 
remained. And DirEntry is somewhat of an odd beast in that it was originally 
intended to be used only for dirEntries and was more of an abstraction on 
dirent (like you get with the C readdir). It's changed quite a bit since then. 
Some of that was me, and some of it wasn't. It's quite possible that some more 
refactoring is in order, and certainly, the fact that DirEntry("foo") compiles 
but doesn't work is a problem. Either it shouldn't compile, or it should work.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list