This is an interesting thread. A few points:

- "box" makes a lot more sense than "new"; as others have pointed out, the
latter maps to a different concept in C++ which makes it familiar in the
worst way.
- "Foo::init" is terrible, agreed, but "Foo::new" is less than ideal as
well. "Foo::create" might be better. Just read this aloud: "this function
news a value." What? That makes no sense. "This function creates a value."
Much better, isn't it? Point being, it should be a verb. JavaScript does it
with Object.create, so there's precedent.
- placement new might be common in Servo and browser engines, but it's not
that common in most C++. After 10 years and 200k+ LOC of C++ across many,
many different programs and paradigms I've yet to use it once. Sure, that's
just one person's experience but others seem to be echoing the same
sentiment. I'm not saying let's not have placement new, just that we
shouldn't put on an undeserved pedestal.

On Dec 2, 2013 11:39 AM, "Patrick Walton" <[email protected]> wrote:
>
> Only if you SROA and inline the constructor, I think.
>
>
> comex <[email protected]> wrote:
>>
>> On Mon, Dec 2, 2013 at 2:33 PM, Patrick Walton <[email protected]>
wrote:
>>>
>>> That would require an unnecessary move. It needs to be built into the
>>> language.
>>
>>
>> Devil's advocate - aren't such unnecessary moves really easy for LLVM
>> to optimize?
>
>
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to