Eliminate "new" for class object creation?

Chad J chadjoan at __spam.is.bad__gmail.com
Tue Oct 20 11:53:02 PDT 2009


Andrei Alexandrescu wrote:
> Leandro Lucarella wrote:
>> Andrei Alexandrescu, el 19 de octubre a las 22:16 me escribiste:
>>> No problem. You will be able to use InSitu!T. It is much better to
>>> confine unsafe features to libraries instead of putting them in the
>>> language.
>>>
>>> {
>>>     auto foo = InSitu!(Foo)(args);
>>>     // use foo
>>>     ...
>>>     // foo goes away
>>> }
>>
>> <useless discussion>
>>
>> Why not Scoped!T ? I think the purpose for this that the lifetime of the
>> object is bounded to the scope, right? I think is hard to figure that out
>> from InSitu!T than Scoped!T.
>>
>> </useless discussion>
> 
> It's not a useless discussions, names are important. Scoped is more
> evocative for in-function definition, whereas InPlace/InSitu are (at
> least to me) more evocative when inside a class.
> 
> class A {
>    InPlace!B member;
> }
> 
> 
> Andrei

InPlace actually sounds good.  InSitu, while appropriate, will just
sound vaguely snooty after the user looks it up in the dictionary (IMO).

InPlace might seem odd in functions though.

void foo(...)
{
	InPlace!B variable;
	...
}

In conclusion, I couldn't give a damn.  ;)



More information about the Digitalmars-d mailing list