Ping? Recently ran into the same issue. The public C++ style guide seems to endorse the "= delete" syntax, but doesn't forbid DISALLOW_COPY_AND_ASSIGN (which it doesn't know about, of course, since DISALLOW_COPY_AND_ASSIGN is part of base), and there's no deprecation notice on the macro. It "feels" like "= delete" is the right thing to do, but it's fuzzy enough to be confusing.On Tue, Jul 9, 2019 at 4:51 PM Reilly Grant <rei...@chromium.org> wrote:Resending from the correct address.This recently came up again on a review: https://chromium-review.googlesource.com/c/chromium/src/+/1528751/5/device/fido/win/webauthn_api_adapter.h#143If we are deprecating use of DISALLOW_COPY_AND_ASSIGN we should update macros.h with a deprecation notice. I personally prefer the macro because it is easier to understand the intent but I will do whatever the style guide tells me to because the style guide is always correct.I have created a CL adding the deprecation notice: https://chromium-review.googlesource.com/c/chromium/src/+/1694142--On Thu, Jun 7, 2018 at 1:01 PM Peter Kasting <pkas...@chromium.org> wrote:--On Thu, Jun 7, 2018 at 11:38 AM Alexei Svitkine <asvi...@chromium.org> wrote:I believe last time we discussed it, there were a few cons to the "= delete" syntax that were brought up:- Ambiguity about where it should be in the C++ file (still last? at the top?). If no strong guidance, it means it will be inconsistent and reviewer has to do more work to see if there.The style guide has an example which places this where you would expect constructors/assignment operators to be declared. I've been told examples in the style guide are normative unless otherwise noted, and this placement makes sense with the rest of the guide. So I'd count this as "guidance to place in the public constructor/assignment operator section".- More lines of code thus more noise to read vs. a single macro people have to be aware of.- Inconsistency between existing code and new code if we don't do a rewrite of everything.- Easier to get wrong (i.e. the macro does the right thing - with the explicit spelling out, you can omit one of the constructors, etc).I think these objections are fair. But I also think they apply equally to Google internally, and if we want to make different decision than they did, we need to understand their line of reasoning sufficiently to see why Chromium has different constraints. As you noted, you write code internally, so I'm curious if you have a take on this.You have not mentioned reasons why this is a good change:
- Consistency with modern C++ coding conventions elsewhere
- Use of standard language idioms that lowers the barrier to codebase entry for external people
- Copyability/non-copyability is now consistently declared in the same place in the class every time
- Non-copyability becomes part of the public API of the class (seems clearer)
- IMO, prods devs to think about copyability and movability distinctly, which is probably a good consideration when designing a class
Some of these overlap or are trivial, but I do think the benefits outweigh the costs here. I do think it's reasonable to disagree :). But I also want to limit the number of exceptions we make to the Google style guide, so the question is not just whether this is a good case for an exception, but whether this is one of the best cases to spend our (imaginary) "exceptions budget" on.PK
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAAHOzFAay9zJfZHmEk8h_qbC8_VajhCE0SQEOEAJQzrP%3DF6UJA%40mail.gmail.com.
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAEmk%3DMYru8PmvkgoMpxbU9ErtnY4W8E1DmcywTux0%2BAvBgwWaA%40mail.gmail.com.
On Wed, Jul 31, 2019 at 5:48 PM K Moon <km...@chromium.org> wrote:Ping? Recently ran into the same issue. The public C++ style guide seems to endorse the "= delete" syntax, but doesn't forbid DISALLOW_COPY_AND_ASSIGN (which it doesn't know about, of course, since DISALLOW_COPY_AND_ASSIGN is part of base), and there's no deprecation notice on the macro. It "feels" like "= delete" is the right thing to do, but it's fuzzy enough to be confusing.
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CACwGi-4n_r6pX48zc_YRaKz0xzzk_ee4y6zUXOUz4BWzSybcaw%40mail.gmail.com.
I share danakj's opinion. Besides consistency, it's also more concise (1 line instead of 2) - and easier to get right (i.e. requires less time for author and CL reviewer since the statement is simpler).On Fri, Aug 2, 2019 at 11:06 AM <dan...@chromium.org> wrote:On Wed, Jul 31, 2019 at 8:48 PM K Moon <km...@chromium.org> wrote:On Wed, Jul 31, 2019 at 5:48 PM K Moon <km...@chromium.org> wrote:Ping? Recently ran into the same issue. The public C++ style guide seems to endorse the "= delete" syntax, but doesn't forbid DISALLOW_COPY_AND_ASSIGN (which it doesn't know about, of course, since DISALLOW_COPY_AND_ASSIGN is part of base), and there's no deprecation notice on the macro. It "feels" like "= delete" is the right thing to do, but it's fuzzy enough to be confusing.My take is that I believe the macro is useful and common enough that we should continue to use it unless we're going to rewrite everything to =delete instead. Since that is surely not worth anyone's time, I would say we should just keep using the macro. We could add it to documentation to make that more clear.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAKFU2SAtdGjLMMnbUOE0i7xUHOWYgiRTmgWkYZg3v2L%3D--t_EA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAJTZ7LLapscOYbkBXxYLAZG_P8ep6vFSALNT4FvokcmEZLUS%2Bg%40mail.gmail.com.
public section of the declaration.To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CACwGi-7Su7MHerXCHCm07i3wTDmhXqU7PFaQnvAojZq3q5CtuQ%40mail.gmail.com.
Based on pkasting's notes about the changes in the Google C++ style guide (and that we have no good reason to override it for Chromium's needs), it seems it's clear that we should deprecate/ban DISALLOW_COPY_AND_ASSIGN() and spawn a code maintenance project to replace all existing ones with =delete.
In the interest of not recommending two ways to do something, if we agree that recommending =delete in new code is the right thing, then let's add a note to base/macros.h reflecting that.
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAKFU2SDdNRXq9ddeGU5MK9JXqeqR4Lk1aud_U%3Dmqs8gYSKGbvQ%40mail.gmail.com.
However, from the thread, we didn't reach an agreement?