DIP 1003 Formal Review

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Mon May 15 22:34:28 PDT 2017


On 16.05.2017 05:44, MysticZach wrote:
> ...

With your proposal, this syntax would already be taken for a function 
with an empty implementation.

> Also, does a final function with contracts, but no body, make any sense?
> What's the use case?
> ...

di files.

> Even if there were some use case for it, I can think of two solutions.
> One is to keep and require the current syntax for an interface function
> without a body. This is the natural way to install contracts anyway, for
> a function with no body.
>
> The other solution is to recommend the addition of an empty statement,
> for an empty final function, e.g.:
>
> // final
> int fun() {
>   in assert(...);
>   {}
> }
>
> Considering what Jonathan said about how he never uses contracts because
> they're so bulky, might it not be worth it to solve the interface
> problem in either of the above two ways?

No. Contracts are not part of the function body, they are part of the 
function signature. That's the point.




More information about the Digitalmars-d mailing list