Was it just me, or did it feel like that particular aspect of 'scala is so cool' totally blew up?
creating objects with the 'with' statement just isn't a good way to modularize. It would be if: you create 1 scala file that's an app, which creates an object via 'with' expansion with just the 'modules' you need, and feed this to scalac. If scalac then somehow built a dependency tree and compiled exactly every file that's needed to make this work, but no other ones (which can involve also picking up .java, groovy, jruby, and jython sources!), *AND* this then triggered a cascade that used these sources itself as the keys to figuring out which static files and other dependencies are required, and then outputted this all to a neat little bundle, *THEN* this would be a great modularization tool. And, on top of that, to fulfill the stated requirement that clients that didn't pay for module X don't even get module X, you should be able to state which files should definitely NOT be included, and scalac should then generate errors if it cannot complete the compile job without compiling those files, which indicates that there are dependencies between modules that you never intended and are hence bugs. That'd be a fine utility, but scala doesn't do any of this. The only way in which this helps, is if your build tool already has the facilities to compile exactly which code you want (and not compile the code you DONT want), and the 'with' tactic is used only to create a few custom bootstrapping classes. However, if everything's already compiled properly because of a build tool, and all you really need to do is create a bootstrap class that knows exactly which code entry points to fire up, then there are much better tools out there in java land (which you can of course use in scala as well!)! - guice should help you with this. Incidentally, guice 2.0 has been released this week. http://code.google.com/p/google-guice/ - The SPI system can help here. The custom compile job (e.g. ant script) generates the right SPI pointer files, and your one main class (instead of the many little ones approach that scala has) will use SPI discovery. This is sort of a roll-your-own lightweight guice deal, but it has the upside of not requiring an external library*. More info on SPI can be found here: http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider *) Is anyone else bothered by the fact that 'requires external library' is such an annoyance? That's a rather serious detriment to code reuse and the whole schtick where java would rather defer to a library that which other languages do in the language space (something Joe Darcy, project coin lead, mentions every other email to the coin- dev list, for example). I wish java shipped out of the box with a lightweight ivy, or better yet, that javac itself compiled to BigJars instead of class files and had a feature for stating dependencies in source files (per module?) which javac would automatically chase down for you. Eh. I'll keep dreaming. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
