Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What if the answer was yes?

There are some things C or C++ are just better at, like operating in a low-memory environment when you want to squeeze as much as possible out of the system. Sure, GC is nice and all, but for things to work well with a modern copying generational GC, you need 2 or 3 times the amount of RAM as an equivalent manually managed tool, because collection is lazy and you don't want to run it on every allocation -- that would be too expensive. So garbage sticks around for a little while.

Alternatively, some people like writing in high-level compiled languages (most of which are faster than Java) like OCaml or Haskell, both of which are suitable for a device that would also be running Java.



edit: If you want to use C/C++ go and so some other mobile device platform and see how "excellent" they are.

>There are some things C or C++ are just better at, like operating in a low-memory environment when you want to squeeze as much as possible out of the system.

No, that depends on the developer. A lot of developers don't want to worry about memory management and memory leaks.

The thing is that they need a VM-based language so they can port the VM over to all sorts of hardware instead of forcing developers to mess around with portability issues. Port of Squeak Smalltalk to the iPhone: http://isqueak.org/HomePage


No, that depends on the developer. A lot of developers don't want to worry about memory management and memory leaks.

That has nothing to do with what I said. If you want to avoid the peak memory overhead of using a GC (and the peak memory overhead is quite a bit higher if you don't want to kill performance -- you'd need to run the GC after every statement that could possibly kill garbage otherwise), you need to use C or C++.

And as for other mobile platforms -- Windows Mobile allows C++, IPhone is in Objective-C, Symbian is C++, etc. Java is popular, but it's not overwhelmingly so. And this is even taking into account that it's easier to get a Java based device approved by carriers/regulators because the VM can trap more attempts to break the OS and thus make sure that you can't trick the software into doing out-of-spec stuff.

GC is a wonderful tool. it prevents leaks, but it needs more memory when you're rapidly generating garbage. I wouldn't want to program without it... unless I'm trying to shoehorn things onto a tiny system.


Java's "write once, run everywhere" is a sham. Even within just the mobile targets.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: