History of trailing comma in programming language grammars

后端 未结 4 1504
执念已碎
执念已碎 2020-11-30 10:16

Many programming languages allow trailing commas in their grammar following the last item in a list. Supposedly this was done to simplify automatic code generation, which is

4条回答
  •  执笔经年
    2020-11-30 10:24

    I'm not an expert on the commas, but I know that standard Pascal was very persnickity about semi-colons being statement separators, not terminators. That meant you had to be very very careful about where you put one if you didn't want to get yelled at by the compiler.

    Later Pascal-esque languages (C, Modula-2, Ada, etc.) had their standards written to accept the odd extra semicolon without behaving like you'd just peed in the cake mix.

提交回复
热议问题