| ▲ | troymc a day ago |
| I made a poster showing how one might write a Hello World program in 39 different programming languages, and even different versions of some common languages like Java: https://troymcconaghy.blog/2025/01/13/39-hello-world-program... |
|
| ▲ | pron a day ago | parent | next [-] |
| Nice, but as of JDK 25 (the preview JEP 445 has become the permanent JEP 512), the canonical Hello World in Java is: void main() {
IO.println("Hello World");
}
|
| |
| ▲ | saagarjha 20 hours ago | parent | next [-] | | Since it seems like you work on Java, would you mind taking a look at https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-836673..., where this syntax does not work for shebangs? | |
| ▲ | prmoustache a day ago | parent | prev | next [-] | | Not a java developer but why the void? Shouldn't your main function and program return an integer? | | |
| ▲ | tadfisher a day ago | parent | next [-] | | I believe that is a C-ism, where the C runtime calls your main() and exits the process with the return value. The Java equivalent is System.exit(int status). | |
| ▲ | gavinray a day ago | parent | prev [-] | | The return type of a Java main is the JVM platform return type Sending system signals is external to the JVM platform |
| |
| ▲ | troymc a day ago | parent | prev [-] | | Thanks, I made a note to update that someday. |
|
|
| ▲ | realo a day ago | parent | prev | next [-] |
| This is super cool! Now someone should make a similar poster with Hello World sent to a serial port. Bonus points if it is a RS485 port. Some language that seem to look good might show their true ugly face... |
|
| ▲ | throwaway150 a day ago | parent | prev | next [-] |
| Cool poster! If you don't mind me asking, would you share what tools you use to create this poster? You've got syntax highlighting going on there too. What did you use for that? |
| |
|
| ▲ | pmdr a day ago | parent | prev [-] |
| Objective C is by far the weirdest on that list. |
| |
| ▲ | saagarjha 20 hours ago | parent | next [-] | | Objective-C is basically Java so I wouldn’t call it that weird. | | |
| ▲ | gnabgib 20 hours ago | parent [-] | | Objective-C is significantly (11 years) older than Java. 1984: https://en.wikipedia.org/wiki/Objective-C 1995: https://en.wikipedia.org/wiki/Java_(programming_language) | | |
| ▲ | saagarjha 20 hours ago | parent [-] | | Correct, Java was designed with a strongly influence from Objective-C. | | |
| ▲ | gnabgib 20 hours ago | parent [-] | | One might even say Java is basically Objective-C | | |
| ▲ | pjmlp 17 hours ago | parent | next [-] | | Kind of, but with C++ syntax to make it more appealing, https://cs.gmu.edu/~sean/stuff/java-objc.html | |
| ▲ | saagarjha 17 hours ago | parent | prev [-] | | No, Java never took anything good from the language. | | |
| ▲ | pjmlp 17 hours ago | parent [-] | | Sun folks disagree, https://cs.gmu.edu/~sean/stuff/java-objc.html https://en.wikipedia.org/wiki/Distributed_Objects_Everywhere Sure, they could have taken a bit more, like proper AOT instead of it being a feature only available in third party commercial JDKs, or some low level niceties like C#. | | |
| ▲ | saagarjha 16 hours ago | parent [-] | | I was talking about good parts of the language | | |
| ▲ | pjmlp 16 hours ago | parent [-] | | Like [] and @ all over the place, C lack of safety, and manual memory management? Because I don't see what else good Java has left out, besides AOT in the box and unsigned types. | | |
| ▲ | saagarjha 15 hours ago | parent [-] | | Uh, the entire runtime? | | |
| ▲ | jeberle 7 hours ago | parent | next [-] | | I would look to the UCSD p-System as a precedent to the JVM. Both are byte-code interpreted VMs. Gosling used the p-system earlier in his career, prior to joining Sun. https://en.wikipedia.org/wiki/James_Gosling#Career_and_contr... The Objective-C runtime is very small: just enough to do late-bound fn calls to a tree of class defs. All on top of C. | |
| ▲ | pjmlp 13 hours ago | parent | prev [-] | | I beg to differ, given the engineering effort that went into JVM across various Java vendors, versus Apple and NeXT have done. Proven by the fact that Swift had to be invented, as there was nothing left to fix Objective-C in a proper way. | | |
| ▲ | saagarjha 12 hours ago | parent [-] | | Swift has that runtime, by the way. | | |
| ▲ | pjmlp 9 hours ago | parent [-] | | Nope, Swift interops with Objective-C runtime to ease code migration from legacy Objective-C code, and existing Apple frameworks predating Swift. A runtime that isn't part of the cross-platform Swift project, with missing functionality being rewriten into Swift. |
|
|
|
|
|
|
|
|
|
|
| |
| ▲ | watersb a day ago | parent | prev [-] | | Smalltalk, but in C |
|