[erlang-questions] lists:reverse/1 as a bui\lt-in function

Richard A. O'Keefe <>
Tue Jan 23 04:01:45 CET 2007


I wrote that Java's package scheme is "inside-out".

Robert Baruch <> misread "inside-out" as
"back-to-front" and asked

	Well, if that's the case, then would it make any difference if the  
	proposal were modified so that the package naming scheme is reversed?  
	So that instead of importing, say, erlang.lang.lists, we import  
	lists.lang.erlang? Or maybe would you rather have just a flat package  
	namespace?
	
Neither.  The issue is not "which order to we write dotted names", but
"where do we START from"?  Java chose absolute package names.  That is
what is bad.  To take just one obvious example, suppose a group of
classes/modules are developed by the Acme Widget company, so all those
dotted names start out
    nz.co.acme_widget.intercal.
Then the Acme Widget company get taken over by Southern Doohicky, Inc,
and now we *want* the names to be
    au.com.southern_doohickey.intercal.
Because package names are *absolute*, every dotted package name has to
be changed.  But if dotted names were *relative* to the containing class/
module, only one name in the entire build would need changing.
unnnecessarily

There are some occasions when you want absolute names, typically when
referring to the library that came with the language.  But when you have
much of your own code, what you nearly always want is relative names so
that renaming and sharing are easier.

	I really don't understand why the package naming scheme is inside-out  
	-- it only looks that way to me when compared to domain names.

That's because you have misread "inside-out" as "back to front".  I don't
care (as yet) whether dotted names are written left to right or right to
left, but it matters a lot where they start from.




More information about the erlang-questions mailing list