Possible enhancement: Concise return statements

pillsy pillsbury at gmail.com
Wed Aug 17 06:48:17 PDT 2011


== Quote from Walter Bright (newshound2 at digitalmars.com)'s article
> On 8/15/2011 12:19 PM, Jacob Carlborg wrote:

> > Can't we always automatically return the last expression, even if it ends with a
> > semicolon?

> It interferes with auto return typing (such as void returns).

Ignoring uninteresting return values in functions performed for side-effects is idiomatic in every language that has
both return values and side-effects. How often do people actually look at the return value of printf?

In the unusual case where it is important to disambiguate, the function can always be declared void, or an explicit
return statement can still be used. The less ceremony necessary to define a function, the better, IMO.

Cheers, Pillsy


More information about the Digitalmars-d mailing list