All pastes #244778 Raw Edit

Someone

public text v1 · immutable
#244778 ·published 2006-11-10 04:30 UTC
rendered paste body
The general form is:
type name qualifiers = init;

type: one of int, char, ...etc..., user defined types
name: [a-zA-Z_][a-zA-Z_0-9]*
qualifiers: one of '*', '[' number ']', '(' arg_list ')'
init: one of '{' func body '}'
             '[' array init ']'
             '(' struct contents ')'

/*examples*/

int(int a) x = {
    return a+3;
};
/* is valid, and is also the same as */
int x(int a) = {
    return a+3;
};

/*note these can be mixed, since an fn decl is identical to a variable decl:*/
int a = 3, x(int n) = {return n+4;}, y[3] = [1, 2, 3];