On Tuesday 2014-12-23 09:59 -0800, Martin Thomson wrote:
> On Tue, Dec 23, 2014 at 9:55 AM, L. David Baron <dba...@dbaron.org> wrote:
> >
> > But that's an implicit constructor that's causing extra refcount
> > traffic, which is one of the things we didn't want here.
> 
> 
> 
> I don't think that it's quite fair to complain about implicit conversion if
> the whole point is to enable implicit conversion of another sort.  And
> maybe something could be done about the refcount traffic.

The problem is that something unexpected is happening.  People
should expect the implicit conversions that are part of the
language.  They generally don't expect implicit creation of smart
pointers to cause reference counting traffic when they make a
function call.

Implicit conversions can be useful when they're carefully designed.
But C++ makes it too easy to create them by accident (by making
1-parameter constructors do implicit conversion by default).  And
this one doesn't look carefully designed, given that it does things
that users don't expect, and it's not clear how to fix that.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Attachment: signature.asc
Description: Digital signature

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to