13

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?

2 Answers 2

17

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.

4
  • 2
    Why do you feel they aren't necessary? They add organization and prevent naming collisions. There isn't a non-ugly way of doing that in erlang at the moment. How do you deal with this?
    – ryeguy
    Dec 22, 2010 at 4:30
  • 1
    @ryeguy: I pretty much agree with what Richard O'Keefe writes, especially the quote in @Scott Lystig Fritchie's answer. As it stands it pretty much just replaces _ with . in the module names. On a practical side much of how OTP and applications are organised is different and would have to be redone to make it work. And I don't like it. :-)
    – rvirding
    Dec 22, 2010 at 12:29
  • 1
    @Longpoke: Well they can't have them! :-)
    – rvirding
    Dec 23, 2010 at 23:56
  • 1
    Name collision is another problem and a package structure doesn't really help with it. I can have a.z and b.z and I can have a_z and b_z yet none collide. But a way to export/rename packages as in Standard ML MLB files would perhaps be nice to have. Dec 24, 2010 at 1:33
7

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 here.

Summary for 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.