std.lifetime?

Nick Treleaven ntrel-public at yahoo.co.uk
Wed Sep 12 08:09:15 PDT 2012


Hi,
There's a pull request to enhance std.container.make:

http://dlang.org/phobos/std_container.html#make
https://github.com/D-Programming-Language/phobos/pull/756

'make' is basically a generic wrapper for both 'new' expressions and 
struct construction. It also adds makeNew, makeArray and makeStaticArray.

As std.container is not really the place for construction of 
non-container types, the request moves 'make' to std.conv, because 
'emplace' is already there, and the two are perhaps related. I don't 
think make or emplace being in std.conv really makes much sense, 
particularly not make.

std.typecons was also considered, but make is not a type constructor, 
it's an instance constructor. Also std.typecons may turn out to be a 
very big module just from actual type constructors alone.

Thinking about this, I thought perhaps a new module std.construct was 
warranted. Expanding the scope of construction to lifetime issues, 
calling it std.lifetime would be more general.

The following existing symbols might benefit from being moved to a 
std.lifetime module, with aliases replacing their existing symbols:

std.container.make
std.conv.emplace
std.typecons.scoped
std.typecons.RefCounted
std.algorithm.initializeAll

Collecting these similar items together should make it easier for 
newcomers to find them.

Thoughts?


More information about the Digitalmars-d mailing list