Minor feature request

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 27 23:20:53 PDT 2016


On 28/06/2016 6:13 PM, Superstar64 wrote:
> Right now, D functions expect a Block Statement
> (https://dlang.org/spec/function.html#FunctionBody) as their function
> body. Changing that to allow any statement
> (https://dlang.org/spec/statement.html#Statement) would provide a few
> new syntactic sugars like:
> ---
> auto func(MyObj obj) with(obj)
> {
>     //...
> }
>
> auto func(int arg) return arg;
>
> auto func() try
> {
>     //...
> }
> finally
> {
>     return //...
> }
> ---

The only one I'm ok with is with, since it is the most similar to what 
we already have.

The others, no thanks. Two extra characters won't hurt you.


More information about the Digitalmars-d mailing list