C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Grouped-namespace "using" statements (floating the idea)

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Thu, 27 Apr 2023 09:48:53 +0200
using namespace A if any_of{X, Y, Z}   One could see it as limitation of using namespace instead.   any_of loosely based on pattern matching proposals.   -----Ursprüngliche Nachricht----- Von:Andrew Tomazos via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Do 27.04.2023 02:37 Betreff:Re: [std-proposals] Grouped-namespace "using" statements (floating the idea) An:std-proposals_at_[hidden]; CC:Andrew Tomazos <andrewtomazos_at_[hidden]>; John Filleau <john.filleau_at_[hidden]>; On Wed, Apr 26, 2023 at 11:21 PM Arthur O'Dwyer via Std-Proposals <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]> > wrote: FWIW, I'm strongly opposed to this. (And I did a double-take at Barry's post: is it April Fool's Day already?)  C++ isn't Perl; we don't use Unix shell globs like that. In C++, curly braces have a couple of different meanings (code block, initializer-sequence), but not "shell glob."  Compare:  using A::{X,Y,Z};  and  enum A {X,Y,Z};  Notice, both are comma-separated brace-enclosed lists of names.  Also, in both cases, each name is introduced into its parent scope.  A slight alteration we could consider would be:  using A {X,Y,Z};  (drop the extra ::), and then perhaps that seems more natural?  It's a common coding style to have a big block of usings at the top of a .cpp file.  This feature would significantly shorten that block.   -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-04-27 07:48:55