|
Authored by: Anonymous on Sunday, April 22 2012 @ 12:51 AM EDT |
Wrong.
It's not even hard.
You figure out if you trying to get Math.sqrt, Science.sqrt, or Custom.sqrt the
same way you do today.
Instead of doing
class Math {
public double sqrt(double) {blah; }
};
You do
class Science {
public double sqrt(double) {blah; }
};
class Math extends Science {
};
Now extend the concept of inheritance to namespaces. Since namespaces are just a
way of resolving names, the compiler and the class loader follow the standard
rules. For fun, you can include mappings in the namespaces that translate
explicitly. Just look at the c++ namespace implementation.
Now for grins, extend the class loader by shoving Apache's mod_rewrite in front
of it. So your classpath could reorganize everything.
Yes, the compiler must follow the same rules as the classloader to make things
work.
Yes it would be possible to be stupid and map all requests for sqrt to
science.sqrt, but who would be foolish enough tot do that?[ Reply to This | Parent | # ]
|
|
|
|
|