Date: Thu, 27 Jun 2019 12:30:03 -0500
> On Jun 27, 2019, at 12:07 PM, Ville Voutilainen <ville.voutilainen_at_[hidden]> wrote:
>
> On Thu, 27 Jun 2019 at 20:01, Arthur O'Dwyer via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
>>
>> On Thu, Jun 27, 2019 at 12:29 PM Kyle Knoepfel via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>>
>>> Here’s an idea I’ve been thinking about a lot regarding functions composed of a single statement, and I’d like your thoughts.
>>> [...]
>>> Does this idea seem worth fleshing out? How difficult would it be for implementations to provide, if it was worthwhile?
>>
>>
>> No, it's not worth fleshing out. It is impossible for implementations to provide. But investigating it further will likely teach you a lot of corner cases about C++!
>
> There's nothing impossible in it, but ideas that require changing
> every c++ parser on the planet need to cure cancer,
> and this idea doesn't.
:) and :(. Point taken, Ville.
To Arthur’s points, function try blocks was actually one of the motivators of my proposal. The first example you provide (using the noexcept operator) just illustrates that placement of the braces even now is important—another one being the optional braces with the for, (do) while, if, switch, etc. selection statements. It’s the responsibility of the author to know when to use one or the other, and what the consequences are. An important (unvoiced) part of my proposal is that there are no breaking changes with respect to current behavior: 'void foo() noexcept(..);' and 'void foo() { noexcept(…); }’ mean different things now as they would even in a world with optional braces. But the more salient point is that the proposal would have considerable consequences for parsers.
Thanks for your thoughts.
>
> On Thu, 27 Jun 2019 at 20:01, Arthur O'Dwyer via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
>>
>> On Thu, Jun 27, 2019 at 12:29 PM Kyle Knoepfel via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>>
>>> Here’s an idea I’ve been thinking about a lot regarding functions composed of a single statement, and I’d like your thoughts.
>>> [...]
>>> Does this idea seem worth fleshing out? How difficult would it be for implementations to provide, if it was worthwhile?
>>
>>
>> No, it's not worth fleshing out. It is impossible for implementations to provide. But investigating it further will likely teach you a lot of corner cases about C++!
>
> There's nothing impossible in it, but ideas that require changing
> every c++ parser on the planet need to cure cancer,
> and this idea doesn't.
:) and :(. Point taken, Ville.
To Arthur’s points, function try blocks was actually one of the motivators of my proposal. The first example you provide (using the noexcept operator) just illustrates that placement of the braces even now is important—another one being the optional braces with the for, (do) while, if, switch, etc. selection statements. It’s the responsibility of the author to know when to use one or the other, and what the consequences are. An important (unvoiced) part of my proposal is that there are no breaking changes with respect to current behavior: 'void foo() noexcept(..);' and 'void foo() { noexcept(…); }’ mean different things now as they would even in a world with optional braces. But the more salient point is that the proposal would have considerable consequences for parsers.
Thanks for your thoughts.
Received on 2019-06-27 12:31:56