Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Java namespaces

Name: Anonymous 2013-12-05 12:37

It always annoyed me that Java has no formal support for structural or procedural programming, but still tries to hack it in with the "static" keyword, effectively turning classes and interfaces into namespaces. What if namespaces were included in Java 8? They'd be identical to classes, but all their members would be public and static by default. Example:


public namespace Math
{
    final double PI = 3.141592654; //public and static by default

    double abs(double a) //public and static by default
    {
        ...
    }

    ...
}


Am I a genius or what?

Name: Anonymous 2013-12-05 13:26

java is shit

Name: Mr. Irrational 2013-12-05 17:14

Java has plenty of support for procedural programming i.e. ;.

And Java jas plenty support for structural programming too e.g. for, while etc.

What you want is reasonable, but it is not called what you think it is called.

Name: Anonymous 2013-12-05 21:32

Classes are an organisational feature just like namespaces, except you can do more with them too. If you want to just group things together then no one is forcing you to create instances of your class or make it have anything other than public fields.

Name: Anonymous 2013-12-06 5:24

>>3
java is shit

Name: Anonymous 2013-12-06 7:14

>>5
java a shit*

Name: Anonymous 2013-12-06 7:35

You got a main method, you can write functions.
It's plenty procedural.
Just make a "Main" class and work from there.

What's the point of your idea other than saving 12 keystrokes when you write a function?

Don't change these.
Name: Email:
Entire Thread Thread List