Declaration syntax

dajones dajones at hotmail.com
Wed Jan 8 06:13:50 PST 2014


"deed" <none at none.none> wrote in message 
news:unsbvdjdsxtsqgfdetby at forum.dlang.org...
> Modifications:
>
> 1. Swap type and name. Like Go, but return type between function name and 
> parameter list.
> 2. Names come first, all other annotations after. ALWAYS. Example:
>
>       private const(int)[] foo(const(int)[] all, int newNum, int sum) {}
>
>    becomes
>
>       foo const(int)[](all const(int)[], newNum int, sum int) private {}

Why have a function declaration take a different form than an expression?

h = sqrt(x*x+y*y)
s = sin(theta)

There's thousands of years of math behind that, we are taught that form 
before we ever get near programming a computer.

result = do_somthing_with(parameters)






More information about the Digitalmars-d mailing list