const/immutable member functions

Torarin torarind at gmail.com
Mon Jan 24 15:17:33 PST 2011


2011/1/24 foobar <foo at bar.com>:
> This "problem" happens because D belongs to the C-family of languages which puts the return type _before_ the function name.
>
> Languages that don't follow this syntactic convention (some would call it a mistake) have it very consistent and readable:
> attribute funcName inputParams -> outputParams { body }
> This is the typical functional language design.

It is arguably more consistent to have the return type come first, as
in variable declarations:

int a = 4;
int foo() { return 5; }

Both "foo()" and "a" are now of type int.

Torarin


More information about the Digitalmars-d mailing list