4 ms·
public class Main { public static void main(String[] args) { System.out.println("Hello, world!"); } } vs print("Hello, world!") Ple
by Longhanks 5y ago
public class Main {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
vs
print("Hello, world!")
Please comment again if you still cannot see the bloat/unnecessary verbosity.
- grishka 5y agoGlobal scope is a terrible invention. The less implicitness there is, the better.
- weatherlight 5y agothen write assembly.
- grishka 5y agoWhat I'm trying to say that at some point in piling up abstraction layers, abstractions stop being helpful and start getting in the way.
- kjeetgill 5y agoWhat? Barring the stack, everything's essentially global in assembly. Like you can touch your process whole address space from anywhere!
- weatherlight 5y agoalso, everything is explicit. the op seems to correlate the two.
- valenterry 5y agoGlobal scope is not a terrible invention and if you look carefully then you will notice that the Java version uses it as well. Or where is the import to get "System" into scope? It's imported globally everywhere (just like all everything from java.lang). So the only question is: should "print" be burried under layers or not. I don't think the advantages of burrying are really worth it.
- kaba0 5y agoOP meant the public static void main part (that is you define what happens encapsulated in a class) Of course implicit imports are needed, like what else would you have without?
- valenterry 5y ago> that is you define what happens encapsulated in a class Apart from that it is really unintuitive to have something "static" within a class (which is commonly understand as a template), it is not encapsulated because it is static _and_ public. _And_ now you can search for this thing everywhere - and what happens if you find two of them? Yeah no, the idea of "public static void main" wasn't a great one, no matter how I look at it. It's much better to be explicit and ask the user to decide which file they want to use as the starting point. > Of course implicit imports are needed, like what else would you have without They are of course not needed. You could also just import everything manually. Okay, Java's import suck, but in a better language you could do "import prelude._" in the beginning of every file and otherwise you are left with keywords only. Not saying that's a great idea, but it certainly can work without implicit imports.
- kaba0 5y agoBut that verbosity doesn’t scale with code size, so it is largely meaningless.