Override block to mark all methods within that block override

51 views
Skip to first unread message

husain jiruwala

unread,
Jun 21, 2017, 6:42:29 AM6/21/17
to ISO C++ Standard - Future Proposals
Hi 


favorite

Proposing a  way I can  take advantage of override keyword without writing override after each method.

I have couple of points to desire such a thing

·         Its error prone to mark each method override when you are dealing with legacy code and introducing the override keyword in the existing class

·         You have too many override methods

·         Override methods maybe scattered around in class declaration mangled with bunch of other methods its good to group them as a good practice.

I am looking for something like override block using scope, when any method is part of this block its same as writing override after the method signature.

e.g.

class derived: public base
{
   public:
 
      override {
              int blah();
               void blahBlah();
                .. and so on
      }
};

 

The above code is supposed to be same as writing override after each method.


Thanks

Husen Jiruwala

Michał Dominiak

unread,
Jun 21, 2017, 7:42:43 AM6/21/17
to ISO C++ Standard - Future Proposals
`override` is a contextual keyword; this won't fly.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/9ec15216-718e-4733-8ae0-9e23fd223fd0%40isocpp.org.

Ville Voutilainen

unread,
Jun 21, 2017, 8:05:48 AM6/21/17
to ISO C++ Standard - Future Proposals
On 21 June 2017 at 14:34, Michał Dominiak <gri...@griwes.info> wrote:
`override` is a contextual keyword; this won't fly.

That's not the reason this won't fly, parsing such a block is unambiguous. But what is being asked for
here is a declaration-block, which should be something more generic than just a block for every single thing
that should be shared among a bag of declarations. There's a good chance that the reflection facilities
will provide a superior mechanism for ensuring that certain declarations are overrides.
 

On Wed, Jun 21, 2017 at 12:42 PM husain jiruwala <husai...@gmail.com> wrote:
Hi 


favorite

Proposing a  way I can  take advantage of override keyword without writing override after each method.

I have couple of points to desire such a thing

·         Its error prone to mark each method override when you are dealing with legacy code and introducing the override keyword in the existing class

·         You have too many override methods

·         Override methods maybe scattered around in class declaration mangled with bunch of other methods its good to group them as a good practice.

I am looking for something like override block using scope, when any method is part of this block its same as writing override after the method signature.

e.g.

class derived: public base
{
   public:
 
      override {
              int blah();
               void blahBlah();
                .. and so on
      }
};

 

The above code is supposed to be same as writing override after each method.


Thanks

Husen Jiruwala

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.

To post to this group, send email to std-pr...@isocpp.org.

Michał Dominiak

unread,
Jun 21, 2017, 8:15:48 AM6/21/17
to std-pr...@isocpp.org
On Wed, Jun 21, 2017 at 2:05 PM Ville Voutilainen <ville.vo...@gmail.com> wrote:
On 21 June 2017 at 14:34, Michał Dominiak <gri...@griwes.info> wrote:
`override` is a contextual keyword; this won't fly.

That's not the reason this won't fly, parsing such a block is unambiguous.

You're right; sorry for the brainfart.
 
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.

To post to this group, send email to std-pr...@isocpp.org.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.

To post to this group, send email to std-pr...@isocpp.org.

husain jiruwala

unread,
Jun 21, 2017, 8:20:32 AM6/21/17
to ISO C++ Standard - Future Proposals
Agree this should be more generic, clang has some tool to add override by scanning code.

Clang cpp11-migrate

To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.

To post to this group, send email to std-pr...@isocpp.org.
Reply all
Reply to author
Forward
0 new messages