Having said that, perhaps having stronger namespaces so that cycles
can only exist within certain limited zones which are forced to
compile together... I don't know. I guess people will abuse anything,
if they get too lazy to separate packages into small modules.
I am, however, quite serious about impls not being able to depend on
other impls, unless they new them. As in, the compiler won't allow a
variable declaration of a class type.
thoughts? (disregard the extremity of the above, just talk about the
impl/interface bit, since I know we can't really completely do away
with cycles)
Christian.
If you mean it's a strong position to take to not allow variable
declarations to be typed to concrete types, that's actually
recommended Java practice anyway, and isn't that controversial. You
always want to make your variables/attributes take the most abstract
possible type, so your code can accept alternate implementations whose
contract fulfils the abstraction. It's not to say one couldn't still
get it wrong with interfaces, since one can play games with interface
inheritance as well, but it's a step.
Christian.
Christian Edward Gruber
e-mail: christiane...@gmail.com
weblog: http://www.geekinasuit.com/
I think, as with most things in this language, we'll have to throw up
some sample source and see what shakes out. At least, we should make
it a compiler warning:
WARNING: Variable reference declared for a concrete type.
And the compiler can have options to make that warning an error, just
like other warnings. I just want to provocatively see if we can't
move one step further, and eliminate concrete references. We'll see.
Christian.
cheers,
Christian.
Christian Edward Gruber
Consider a mavenized app. I can mave module (project) 1, which has
package1 and package2, with no cycles. I have module2 which also has
package1 and package2. Module 2 can depend on package 1, and have a
class in its package2 depend on module1.package2. I can also have
module1.package1 have a dependency on module1.package2. This looks
like cross-namespace dependencies, and it is, but the fact that they
were packaged up in separate jars, and are themselves somewhat
isolated, makes it hard to have namespace be a meaningful boundary.
In fact classloaders with scoping make it a little hard to do this,
without creating certain barriers that would prevent noop code from
interoperating cleanly with other JVM hosted code - (currently) a
project goal.
I still like it, and we've talked a bit about having some sort of
component/module boundary (and I think that would be appropriate for
this limitation) but we haven't gotten down to brass tacks on how it
would work.
Christian.