Why is the hyphen conventional in symbol names in LISP?

后端 未结 3 1811
深忆病人
深忆病人 2021-02-14 22:54

What\'s the reason of this recommendation? Why not keeping consistent with other programming languages which use underscore instead?

3条回答
  •  猫巷女王i
    2021-02-14 22:55

    Just a guess: it may be because it resembles English language's compound words (like "well-known", "merry-go-round", etc). Like Paul said in comment, it's one of the oldest languages and for the creators of LISP hyphen might have seemed more natural than, for example, an underscore.

    Side note: I, personally, do like it, because it separates words, but at the same time makes the long identifier look as a whole (compare fooBarBaz, foo-bar-baz and foo_bar_baz).

提交回复
热议问题