DIP 1003 Formal Review

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed May 17 06:03:50 PDT 2017


On 5/17/17 8:47 AM, Patrick Schluter wrote:
> On Tuesday, 16 May 2017 at 19:25:25 UTC, Steven Schveighoffer wrote:
>>>
>>> 1) Consistency with functions without contracts.
>>
>> This only applies to the "naked" version which has ugly }{ in it. The
>> other options people are asking about are replacing body with a
>> keyword, which I think you agree would be bad for consistency?
>>
> I don't understand why this would be uglier than )( used in templates.
> Since imo it is one of the highlights of D to have "discovered" that one
> didn't need the super-ugly <> template pars of other languages, as the
> relative position in the code made it absolutely unambiguous which is
> which.

Sure, it could be something we get used to.

However, since naked {} are generally treated as a new scope and valid 
in many places, it looks strange.

> The same is true for function bodies. It is completely unambiguous where
> it starts and ends. As for }{, it would be rare anyway, as it would
> generally be written vertically
> out {
>   assert(whatever);
> }
> {
> ....
> }
>
> or even
>
> out { assert(whatever);}
> {
>  ...
> }

This has been hashed out in this thread quite a bit. It's a perception 
thing, not really a technical problem. And my perception is that it's 
ugly :)

I think in practice, it would turn out probably fine.

-Steve


More information about the Digitalmars-d mailing list