On Tuesday, December 05, 2017 14:25:12 Ali Çehreli via Digitalmars-d-learn wrote: > Selective imports complicates matters. Changing the imports lets it > compile with 2.076: > > void main() { > import std.datetime; > import std.stdio: writeln; > > StopWatch sw; > writeln(sw.peek.msecs); > }
Yes, and then you'll get deprecation warnings with 2.077. The cleanest way to deal with replacing the TickDuration versions of the benchmarking stuff with the MonoTime/Duration versions was to put the new ones in a module that isn't imported by std/datetime/package.d and leave the old functions in package.d (the whole reason that the old benchmarking stuff wasn't replaced sooner was because it required splitting std.datetime first to do it in even a semi-clean manner). Once they've gone through the full deprecation process and are gone, then std.datetime.stopwatch can be publicly imported in package.d, and the import mess will be clean again. But fortunately, if you do import std.datetime.stopwatch : StopWatch; import std.datetime; everything works just fine, because the module system then prefers the one that's selectively imported. So, it's much less of an import mess than it would be otherwise. I was surprised at how cleanly D's module system deals with the potential conflict. - Jonathan M Davis