Why aren't erlang packages used?

2019-02-21 10:25发布

问题:

I found this page about packages in erlang. Not only have I never seen any code that utilizes this, but I haven't even heard of them before. They aren't in any books or tutorials that I know of. Are they new? Was this just a concept or proposal?

If they aren't used, why not? If they aren't yet implemented, is there an ETA?

回答1:

Packages have been implemented but as yet they are only experimental, mainly because there is no consensus whether they should be in the language or not. Many, including myself, feel that they are not worth the effort and wouldn't really add much to the language. Others think that the idea itself is not so bad but that this is not a good way to do it. Others would like to see them in the language. No ETA as yet.

My view is that every effort should be made to keep Erlang small and nothing should be added which doesn't provide a very clear benefit. And I don't think that packages do that. Although I haven't got as far as those who say that for every new feature you add to the language you should remove something.

Anyway that is why they are not mentioned in books and such.



回答2:

You aren't the first to ask this question, but the mailing list archives are full of discussion of whether dot-separated-namespaces are a good idea, and the general consensus is "no". To find a fairly concise summary of the "no" side of the debate, see:

http://erlang.org/pipermail/erlang-questions/2008-March/033416.html

Summary from the lazy, from Richard O'Keefe's message: "Not the least of the problems is that Java-envious dotted package
names aren't really hierarchical; they are just flat strings with funny spelling."



标签: erlang