On Friday, 21 July 2017 at 15:13:09 UTC, Timon Gehr wrote:
"in and out expressions must come at the end of the function declarator suffix, and before the regular contracts, if any"

The implementation actually allows all possible notations for contracts to be mixed freely. Whether or not 'do' is required depends on what notation is used by the last contract.

I decided that for grammar purposes it would be easier to require the contract expressions before the contract blocks. Contract blocks are currently conflated grammatically with FunctionBody [1]. An accurate grammar that describes the current implementation would be twice as complicated, because FunctionBody would have to be redefined. I want the feature to be as simple as possible to understand, so I didn't think it was worth it.

There has also been mention of the possibility of improving the implementation of contracts to allow separate compilation, in which case the signature, plus contracts, could some day appear without the body. I wanted to define the new expressions to accommodate this possibility.

[1] https://dlang.org/spec/grammar.html#FunctionBody

Reply via email to