News for hackers. Stuff that matters.
Re:Go's Declaration Syntax (2010) by Peaker on Tuesday November 25, 2014 @09:41AM (#8657871)
Well, in C, the type operators are:

    Ptr(Type) -- deref type
    Array(Count, Type) -- elem type
    Func(ParamList, Type) -- return type
Since the "Type" param is always there. C declaration syntax is like a linear composition of operators where the Type flows through all the operators to form the final type. The base type on the left of the declaration is the initial parameter that goes through the composition.

So C type operator grammars (in the right-hand side of the declaration, excluding the base type) are actually:

    Ptr      *rest_of_type
    Array  rest_of_type[count]
    Func  rest_of_type(params)
That is why I say ptrs are prefix and array/func are postfix.

All 3 have the extra implicit type argument that comes from the wrapping type-expression and the base type - so I wouldn't include it and say they're both prefix and postfix.

There are no comments on this comment yet.