←back to thread

Java Hello World, LLVM Edition

(www.javaadvent.com)
200 points ingve | 7 comments | | HN request time: 0s | source | bottom
Show context
troymc ◴[] No.46181738[source]
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...

replies(4): >>46181790 #>>46181936 #>>46182649 #>>46183494 #
pmdr ◴[] No.46182649[source]
Objective C is by far the weirdest on that list.
replies(2): >>46184102 #>>46188470 #
saagarjha ◴[] No.46188470[source]
Objective-C is basically Java so I wouldn’t call it that weird.
replies(1): >>46188475 #
gnabgib ◴[] No.46188475[source]
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)

replies(1): >>46188529 #
saagarjha ◴[] No.46188529[source]
Correct, Java was designed with a strongly influence from Objective-C.
replies(1): >>46188549 #
gnabgib ◴[] No.46188549[source]
One might even say Java is basically Objective-C
replies(2): >>46189835 #>>46189853 #
saagarjha ◴[] No.46189835[source]
No, Java never took anything good from the language.
replies(1): >>46189860 #
pjmlp ◴[] No.46189860[source]
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#.

replies(1): >>46190156 #
saagarjha ◴[] No.46190156[source]
I was talking about good parts of the language
replies(1): >>46190182 #
1. pjmlp ◴[] No.46190182[source]
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.

replies(1): >>46190627 #
2. saagarjha ◴[] No.46190627[source]
Uh, the entire runtime?
replies(2): >>46191360 #>>46195890 #
3. pjmlp ◴[] No.46191360[source]
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.

replies(1): >>46191937 #
4. saagarjha ◴[] No.46191937{3}[source]
Swift has that runtime, by the way.
replies(1): >>46193584 #
5. pjmlp ◴[] No.46193584{4}[source]
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.

replies(1): >>46215989 #
6. jeberle ◴[] No.46195890[source]
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.

7. saagarjha ◴[] No.46215989{5}[source]
Yes, and those platforms are worse off for it.