On Thursday, April 28, 2016 at 1:03:07 PM UTC+10, Ehsan Akhgari wrote: > [...] > What about having a MaybeMove function that implementation wise is the > same as Move, but is exempt from the static check? That name has the > advantage of making it clear that a move _may_ happen, but not necessarily.
> On 2016-04-28 9:52 AM, Gerald Squelart wrote: > > Anyway, how about this: > > - mozilla::Move() is reserved for expected moves, and *any* re-use after > > that is considered an error. > > - We introduce something like mozilla::MakeAvailableForMove(), which allows > > for re-use. > > - For extra safety, we could allow MakeAvailableForMove() to only work on > > classes that have a special attribute, e.g. MOZ_TYPE_IS_REUSABLE_AFTER_MOVE. > > What's the semantics of MakeAvailableForMove()? Something similar to my > MaybeMove suggestion? Exactly the same! I.e., the same implementation as plain Move, but static analyzers won't complain. Anyway, reading some ideas, it may be true that there are always other ways to implement optional moves (l-value ref, etc.). So maybe we should just go ahead with preventing Move'd object reuse for now, as it's the safest option. And in the future if someone sees a really compelling case that cannot be done as effectively otherwise, they can work on an unchecked way to optionally-move&reuse objects. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform