News for hackers. Stuff that matters.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:25PM (#28981547)
Global scope is a terrible invention. The less implicitness there is, the better.
Re:New language features since Java 8 to 17 by valenterry on Sunday October 24, 2021 @09:40PM (#28983666)
Global 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.

Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:28AM (#28985640)
OP 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?
Re:New language features since Java 8 to 17 by valenterry on Monday October 25, 2021 @04:44AM (#28985747)
> 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.

Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @04:29PM (#28981587)
then write assembly.
Re:New language features since Java 8 to 17 by kjeetgill on Sunday October 24, 2021 @08:02PM (#28983117)
What? Barring the stack, everything's essentially global in assembly. Like you can touch your process whole address space from anywhere!
Re:New language features since Java 8 to 17 by weatherlight on Monday October 25, 2021 @09:18AM (#28987428)
also, everything is explicit. the op seems to correlate the two.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:33PM (#28981623)
What I'm trying to say that at some point in piling up abstraction layers, abstractions stop being helpful and start getting in the way.