3 ms·
Everything is great until the flamebait at end. "It is possible to do it all in Swift making it a versatile language unlike Java or Scala" Anybody cares to el
by stonewhite 12y ago
Everything is great until the flamebait at end.
"It is possible to do it all in Swift making it a versatile language unlike Java or Scala"
Anybody cares to elaborate on that?
- ankurpatel 12y agoHaving done Java programming I have not been able to write code where I can directly allocate memory in the heap and iterate over it like in C. Correct me if I am wrong with an example.
- virmundi 12y agoI don't think this addresses your question directly, but there is always Unsafe. You can do a lot of direct memory manipulations through it. http://highlyscalable.wordpress.com/2012/02/02/direct-memory-access-in-java/ http://highlyscalable.wordpress.com/2012/02/02/direct-memory...
- ankurpatel 12y agoGood article but trying to write code like in the examples seems very cumbersome compared to writing it in Swift. The Java language syntax is partly to blame.
- panzi 12y agoWhy would you want to do that in Java?
- tedunangst 12y agonew byte[]?
- Dewie 12y ago> where I can directly allocate memory in the heap Doesn't the "new" keyword always heap-allocate? I guess modulo optimizations like "this is a value-class that won't escape the scope of the method: "in-line" it" (if that is a technique that is in use/possible). Also, it seems reasonable that an array of primitive values would actually be represented as a contiguous piece of memory in the heap. Sorry if that wasn't what you asked about.