Advertisement · 728 × 90

Posts by Ilari Suhonen

Looks great, the IETF is amazing :)

6 months ago 1 0 0 0

TeaVM seems promising if you can use WASM :)

6 months ago 0 0 0 0

I guess that's true. It's possible to think of Rust's box as a kind of "virtual" object on the heap which wraps the real value but occupies zero bytes, much in the same way that the layout of structs is erased at compile time. In this way it's still a "box" and works the same as a real-life box.

6 months ago 0 0 0 0

This is what "boxing" means in Java; a Box is a concrete object on the heap with a value that is distinct from the primitive value (indeed, primitive values can't be on the heap in the first place).

In Rust, primitive values do exist on the heap, and they may be placed there using Box.

6 months ago 1 0 0 0
IntelliJ RustRover's Debugger view showing the heap memory of a Rust progrma which places the value 3 in a Box and stores the pointer to the Box in a local variable 'b'.

IntelliJ RustRover's Debugger view showing the heap memory of a Rust progrma which places the value 3 in a Box and stores the pointer to the Box in a local variable 'b'.

The HotSpot JVM debugger and Java Debugger showing the source code, stack, and heap for a program which creates a local variable of type Integer and assigns the primitive value 3 to it. The memory view shows the Integer object retains metadata such as the mark and compressed klass pointer, instead of only the value 3.

The HotSpot JVM debugger and Java Debugger showing the source code, stack, and heap for a program which creates a local variable of type Integer and assigns the primitive value 3 to it. The memory view shows the Integer object retains metadata such as the mark and compressed klass pointer, instead of only the value 3.

Kind of, but not in the implementation sense. See the attached screenshots; Rust places the raw value, 3, on the heap when it is boxed. Java, however, places a full "box", that is to say, an Integer object which contains the value 3, complete with its mark, klass pointer, and value.

6 months ago 1 0 2 0

Box is a pretty confusing name, but I prefer it to HeapPtr, HeapPointer or HeapValue because pointers have their own semantics in Rust and Box is a shorter and cleaner name that doesn't pollute code all that much and clarifies the strong ownership semantics by reserving a specific term.

6 months ago 0 0 1 0

In Java specifically, the reference on the stack is a pointer to the object header, which is the start of the value of the object on the heap.

In Rust this idea breaks down because Rust stores the value directly on the heap instead of putting it in a boxing object (like a struct)

6 months ago 0 0 2 0

Hm, true. Originally, I believe, the Box was the object that was in the heap and contained the inner value of type T. So you wouldn't be "moving the Box", but moving the address on the stack that tells you where the Box is.

6 months ago 0 0 1 0
Advertisement

Sometimes mythology, sometimes blue.lhf.linear_algebra_library...

6 months ago 1 0 0 0

Honestly don't worry about it so much, learning one imperative language well puts you far on the track of learning the others.

6 months ago 1 0 1 0

your kid sounds based

8 months ago 1 0 1 0

Try looking into Collectors.groupingBy :)

8 months ago 0 0 1 0

You can add the Russian ad list to your ad blocker's filter lists to block them :) easylist-downloads.adblockplus.org/ruadlist+eas...

9 months ago 0 0 0 0
Post image

Here's another one which is probably illegal but won't re-compute if you call the method on the record and also doesn't come with the frustrating additional "get()" call.

9 months ago 1 0 0 0
Post image

Like this:

9 months ago 4 0 1 0

Work towards features like this is being done with JEP 468, for example :) For now, you'd still need a default constructor though and it would be a valid record at each step

9 months ago 2 0 0 0

Not exactly what you want, but you can achieve this behaviour with a method that returns a supplier that returns a variable that was frozen by the lambda

9 months ago 2 0 1 0
Advertisement

Just have to become a better VM-powered developer! The resources to learn about how the JVM organises objects in memory are available online (especially if you read C++)

With the new MemorySegment API, too, Java developers can do direct memory access :)

1 year ago 1 0 1 0

I remember there being some problems with developing annotation processors when using Maven as a build tool — do you use a different build tool? If you use Maven, did you run into any quirks and if so, how did you circumvent them?

1 year ago 0 0 1 0

brilliant i want it

1 year ago 0 0 0 0

i don't remember the exact powershell commands to compile and run java without a build tool but i bet it's

cd $Env:UserProfile\Desktop
javac com\craftinginterpreters\tool\GenerateAst.java
java com.craftinginterpreters.tool.GenerateAst

1 year ago 1 0 0 0

you should try setting up your project using IDEA community edition instead :) it's free !!

1 year ago 1 0 1 0

noo :( java.* returns Nothing — packages aren't arranged hierarchically like folders, so for example the 'java.util' package is not "inside" the 'java' package, they are completely separate and just happen to both start with "java."

1 year ago 3 1 1 0

Since you're trying to make an app, learn Kotlin, Dart or TypeScript :)

Kotlin and Dart are easier if you already know Java and TypeScript is easier if you already know JavaScript

(and also note that your first app will probably suck, especially if you're learning programming at the same time)

1 year ago 1 0 0 0
Preview
Java (programming language) - Wikipedia

These posts always show up on my feeds for Java: en.m.wikipedia.org/wiki/Java_(p...

Delightful little birds! I only wish Bluesky knew the difference between Java, and, well, Java.

1 year ago 1 0 0 0

obligatory "this wouldn't have happened if you were using Java"

1 year ago 2 0 1 0

C# isn't that fast! In any case, I'd hazard a guess that a lot of the benchmark time is spent inside the Bun runtime, which is written in Zig (and so performance should be roughly comparable to C)

1 year ago 1 0 0 0
Advertisement

new PrintStream(OutputStream.nullOutputStream()) and just println() your screams right in :)

1 year ago 2 0 0 0

"Calculate retained size and biggest objects" is a great opportunity to take a break, meditate for a while and get a coffee :)

2 years ago 1 0 0 0