From: Sean Russell Date: 2001-12-14T23:27:41+09:00 Subject: [ruby-talk:28504] Re: Package Naming Nat Pryce wrote: > files put in, how does the administrator put them there, etc.) .However, > Ruby code does care about the name of the Ruby file in which a class is > deployed, while Java code it does not care about the name of the JAR file > in which a class is deployed. .... > Therefore, we had to tune the packaging of classes into JAR files to > decrease startup time for different client applications. In Java you can I understand what you are saying, but I still don't see how this pertains to Ruby. Tell me again why you'd move Ruby classes around? Ruby doesn't have these deployment issues, although it will eventually suffer from the same path creep that Perl suffers from -- if you're Perl installation is old enough, eventually your load path starts to look like a novella. Either that, or every time you upgrade Perl, you have to reinstall a boatload of packages. When you compare moving Ruby files to moving Java files, you have to make an orthoganal comparison of the practical aspects of the issue. Jar files are just locations in the classpath -- as long as the location is in the classpath, you can move Java class files arbitrarily without any changes to sourcecode. This is no different than Ruby. As long as the target location is in $:, you can move the Ruby file around in the classpath. Now, if you want to actually change the path so that it would affect the "require", I argue that this is like changing the package name in Java, which is *also* a path corresponding to a real filesystem path. package us.fed.fs; class MyClass { } corresponds *directly* to us/fed/fs/MyClass.class Sure, you can move this class around between Jar files, but you *still* have to maintain that full path. The package name is dependant on the filesystem path. So moving the class from one.jar to two.jar is just moving the class, including the entire file hierarchy corresponding to the package name that contains that class, around in the classpath locations. If you want to change the path of the class to, say: us/fed/nsa/MyClass.class you have to change the package name in the source code. The same holds for Ruby. If you have a file: rexml/dtd/dtdparser.rb this is orthoganal to the Java package name. You can move this around within elements of $: without changing any sourcecode, as long as you maintain the pseudo-package name. If you want to change it to nqxml/dtd/dtdparser.rb you have to change the sources. Just like Java. -- --- SER