SCHeng

It all returns to nothing.

, 解释器

如何给一个新的语言命名?

scheng

最近在看Crafting Interpreters,虽然只看到第一章,但是其中的一个note还是挺有意思的,所以在这里记录、翻译一下。

DESIGN NOTE: WHAT’S IN A NAME?

One of the hardest challenges in writing this book was coming up with a name for the language it implements. I went through pages of candidates before I found one that worked. As you’ll discover on the first day you start building your own language, naming is deviously hard. A good name satisfies a few criteria:

  1. It isn’t in use. You can run into all sorts of trouble, legal and social, if you inadvertently step on someone else’s name.

  2. It’s easy to pronounce. If things go well, hordes of people will be saying and writing your language’s name. Anything longer than a couple of syllables or a handful of letters will annoy them to no end.

  3. It’s distinct enough to search for. People will Google your language’s name to learn about it, so you want a word that’s rare enough that most results point to your docs. Though, with the amount of AI search engines are packing today, that’s less of an issue. Still, you won’t be doing your users any favors if you name your language “for”.

  4. It doesn’t have negative connotations across a number of cultures. This is hard to be on guard for, but it’s worth considering. The designer of Nimrod ended up renaming his language to “Nim” because too many people remember that Bugs Bunny used “Nimrod” as an insult. (Bugs was using it ironically.)

If your potential name makes it through that gauntlet, keep it. Don’t get hung up on trying to find an appellation that captures the quintessence of your language. If the names of the world’s other successful languages teach us anything, it’s that the name doesn’t matter much. All you need is a reasonably unique token.

以下是我翻译的内容

编写这本书的时候最困难的挑战之一就是为其实现的语言命名。在选择出一个合适的名字之前,我浏览了几页候选的名字。就好像你在构建自己的语言的第一天就会发现,命名十分困难。一个好名字满足几个条件:

  1. 没有被使用过。 如果你不小心与别人的名字重名了,那么就会遇到诸如法律问题、社会问题等的各种麻烦。

  2. 发音容易。 如果一切顺利,那么大家将可能念出以及写下你的语言的名字,任何长于几个音节或者比几个字母长的东西都会使大家厌烦的。

  3. 足够独特,易于搜索。大家会通过搜索引擎搜索你的语言名称来了解它,所以你需要一个足够罕见的词,那么大多数的结果都会指向你的文档了。不过随着目前人工智能搜索引擎数量的增加,这已经不是什么问题了。尽管如此,如果你把你的语言命名为“for”,这是不会给你的用户带来好处的。

  4. 在许多文化中没有负面意义。,这是很难提防的,但是也是值得考虑的。Nimrod的设计师最终把他的语言重命名为”Nim”,因为大多数人及的Bugs Bunny使用“Nimrod”作为侮辱。

如果你的潜在名字通过了这些挑战,请保留它。不要急于寻找一个能体现你的语言精髓的称谓。如果说世界上的其他语言的名字教会了我们什么,那就是名字并不重要。你所需要只是一个相当独特的象征。


然后我已经想好了在读完这本书后该给我的语言取的名字了,等我真的把这个语言做出来了再讲。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注