std.path review: update
Jonathan M Davis
jmdavisProg at gmx.com
Mon Jul 18 02:38:13 PDT 2011
On Monday 18 July 2011 09:35:17 Lars T. Kyllingstad wrote:
> On Sun, 17 Jul 2011 17:43:42 -0400, bearophile wrote:
> > Lars T. Kyllingstad:
> >> I believe I have covered most of your requests, with a few exceptions:
> > compatibleStrings is a template still.
>
> I know. Sorry, forgot to mention that. For now, I'd like to keep it the
> way it is. I can't find any precedence in Phobos for turning these kinds
> of tests into CTFEable functions, and if compatibleStrings were to end up
> in std.traits, for instance, it would stand out as being different from
> everything else in there. If it is decided that it is better to write
> these tests as ordinary functions, that should probably be done
> throughout Phobos.
And it _should_ be a template. All of the stuff like that are templates. And
I'm not even sure that it _can_ be a function. And even if it can, what would
we gain by making it a function anyway? It's operating on types. It's of no
use at runtime. It's a perfect candidate for an eponymous template.
std.traits, std.range, etc. do this sort of thing in pretty much exactly the
same way. There may be a cleaner way to write it then it currently is, but
using an eponymous template like that is the correct thing to do.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list