frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

The New MCP Roadmap

https://blog.modelcontextprotocol.io/posts/mcp-roadmap/
79•pentagrama•2h ago•53 comments

A Kantian Critique of "Sorry" by Justin Bieber

https://decodingvibes.com/blog/a-kantian-critique-of-sorry-by-justin-bieber/
113•altmanaltman•2h ago•44 comments

A Friendly Introduction to Racket

https://geometridae.bearblog.dev/a-friendly-introduction-to-racket/
30•signa11•1h ago•3 comments

ElevenLabs, TwelveLabs, ThirteenLabs

https://quantumi.sh/public/labs.html
18•jemoka•1h ago•2 comments

Munder Difflin – Agent harness to run an office of your clones

https://munderdiffl.in/
169•simonpure•6h ago•69 comments

Z80 – The 1970s Microprocessor Still Alive (2021)

https://www.computer.org/csdl/magazine/mi/2021/06/09623402/1yJTvlRLmhi
74•asdefghyk•6h ago•35 comments

Show HN: Rotation via Double Reflection

https://static.laszlokorte.de/rotor-reflect/
20•laszlokorte•22h ago•3 comments

Rust Glancer: Rust LSP using 100x less RAM

https://rust-glancer.github.io/blog/hello-world/
344•matklad•20h ago•70 comments

Hook, hold, harvest and hide: Meta's alleged strategy laid out in first week

https://www.theguardian.com/technology/2026/aug/22/meta-trial-children-privacy
136•sbulaev•4h ago•79 comments

Felony Bench

https://www.felonybench.com/
791•colinprince•1d ago•311 comments

Kobo can run apps now

https://bandarlabs.github.io/Cobalt/
616•thepoet•23h ago•196 comments

Felony charges for citizen deleting phone data at US Border

https://www.nytimes.com/2026/08/21/us/politics/samuel-tunick-deleted-phone-felony.html
946•floathub•1d ago•1162 comments

I accidentally logged hundreds of thousands of phone calls to military bases

https://lina.sh/blog/hijacking-e164-arpa
619•gavide•1d ago•81 comments

Stop Making TUIs

https://sockpuppet.org/blog/2026/08/20/stop-making-tuis/
289•underdeserver•1d ago•367 comments

Zig’s Io.Threaded is neat

https://matklad.github.io/2026/08/06/neat-io-threaded.html
122•chilipepperhott•1d ago•67 comments

There's no reason for software to be slow anymore

https://danluu.com/perf-opt/
556•Jach•15h ago•400 comments

Kagi added a setting for removing paywalled links from search results

https://kagi.com/changelog#11296
1193•speckx•1d ago•374 comments

OTel isn’t going well

https://matduggan.com/otel-isnt-going-well-and-i-made-a-spreadsheet-about-it/
183•hn_acker•22h ago•76 comments

Scientists release biggest 2D map of the universe

https://newscenter.lbl.gov/2026/08/10/scientists-release-biggest-2d-map-of-the-universe/
231•NKosmatos•21h ago•63 comments

Three important steps in my maturation process

https://thomasdullien.github.io/posts/2026-08-21-three-important-steps-in-my-maturation-process/
190•tdullien•17h ago•87 comments

How Thailand Resisted Colonization

https://worksinprogress.co/issue/how-thailand-resisted-colonization/
82•karakoram•21h ago•29 comments

Canada suspends trade negotiations with USA and match tariffs dollar for dollar

https://www.pm.gc.ca/en/news/statements/2026/08/21/statement-prime-minister-carney-canada-us-trad...
614•backlit4034•5h ago•552 comments

AI boosted homework scores, then exam scores dropped: study

https://www.economist.com/graphic-detail/2026/08/18/does-ai-stop-children-from-learning
352•dash2•3d ago•351 comments

Claudette: Make Claude stop talking like a BuzzFeed article

https://github.com/adnanakil/nobuzz/blob/main/README.md
325•aakil•1d ago•207 comments

Everyone says assembly is untyped—everyone is wrong

https://www.gingerbill.org/article/2026/08/20/designing-odins-inline-asm/
128•adamrezich•1d ago•57 comments

I'm becoming AI-blind

https://cymerys.com/w/im-becoming-ai-blind
442•rcymerys•1d ago•452 comments

Optimizing meshoptimizer to process billions of triangles in minutes (2025)

https://zeux.io/2025/09/30/billions-of-triangles-in-minutes/
56•corysama•22h ago•0 comments

People of ACM – Russ Cox

https://www.acm.org/articles/people-of-acm/2026/russ-cox
157•signa11•5d ago•20 comments

Early-life stress leaves a 'scar' inside brain cells in mice

https://medicine.washu.edu/news/how-early-life-stress-leaves-a-scar-inside-brain-cells/
119•gmays•1d ago•55 comments

Embedded AI

https://nostarch.com/embedded-ai
16•0x54MUR41•7h ago•5 comments
Open in hackernews

Understanding Java's Asynchronous Journey

https://amritpandey.io/understanding-javas-asynchronous-journey/
17•hardasspunk•1y ago

Comments

Neywiny•1y ago
I don't get it. The first example in JS vs Java looks very similar. Now all those other code blocks, they certainly have more going on but idk how that compares to JS. And to answer the questions:

A completable future is something that in the future may complete. I think that's self explanatory. A promise seems equally vague.

Boilerplate looks the same. JS is just a function, Java they put a class around it. Java requires exception handling which is annoying but having fought errors in async JS, I'll take all I can get.

API is eh. Sure. But that's not even shown in this example so I have no idea.

So JS saves like 3 lines? Is that really so much better?

cogman10•1y ago
> A completable future is something that in the future may complete. I think that's self explanatory.

But not the reason for the name :).

It's called "completable" because these futures have a method on them `future.complete("value")`. Before their introduction, there was a `Future` API that java had.

nogridbag•1y ago
Yeah that first example is rather poor. And it uses the word boilerpate to seemingly refer to the stuff unrelated to the async code (class declaration, exception handling, main method).

I don't use Java async much, but I guess if you have a utility method named "setTimeout" than the example can simply be:

    public CompletableFuture<String> fetchData() {
        return setTimeout(() -> "Data Fetched", 10000);
    }

    public void loadData() {
        fetchData().thenAccept(System.out::println);
    }
Which is simpler or equivalent to the JS example.
stevoski•1y ago
The Java 1 example uses lambdas, which were introduced in Java 8.

It’s probably intentional, because it allows showing the Java 1 Thread approach succinctly.

But as long-term Java person, I find it jarring.

philipwhiuk•1y ago
Java's had `var` since Java 10 but apparently the author deliberately ignored that to make the example as wordy as possible.

It's a little tiring to read a Java example with an entry-point (the public-static-void bit) and then a JavaScript example without one.

If you strip that out the original Java is:

  var future = CompletableFuture.supplyAsync(() -> {
        try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return "Data Fetched";
        });
  future.thenAccept(result -> System.out.println(result));
  System.out.println("Prints first"); // prints before the async result
which is only obtuse due to checked exceptions.

Arguably it's still a different thing you're doing, because it's not scheduling a task on a pool, it's creating a thread which sleeps for 10 seconds.

elric•1y ago
`var` is very unhelpful in situations where the reader might not be entirely familiar with the context, especially when using factory methods.

I don't think the author was trying to make the example "wordy" so much as "clear".

cogman10•1y ago
Also, arguably, the wrong way to do something like this.

The author uses `setTimeout` for javascript. The equivalent for Java is either the `Timer` class or a `ScheduledExecutorService`. Doing a `Thread.sleep` simply isn't how you should approach this.

With that in mind, if you want to use both these things and keep the completable future interface you'd have to do soemthing like this.

    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
    var future = new CompletableFuture<String>();
    scheduler.schedule(()->future.complete("Data Fetched"), 10, TimeUnit.SECONDS);
    future.thenAccept(result -> System.out.println(result));
    System.out.println("Prints first"); // prints before the async result
    scheduler.shutdown();
AtlasBarfed•1y ago
Does no.js still limit you to a single core/CPU use?

Or as a node successfully been able to start utilizing more cores underneath its JavaScript single thread model. It presents the programmer?

I just remember early node.js from like 15 years ago and the single background task limitation of JavaScript running in a web page.

Cuz you got async code is nice, but what you really wanted to be able to harness in modern CPUs is multi-core

That said, I've been looking for an article like this for a while, although I think there are other associated libraries that also had steps in here. I do think the jvm adopted a lot of those, but I'm not sure if they actually are better than the original extension libraries.

msgilligan•1y ago
I simplified the first example to:

  void main() {
      CompletableFuture<String> future = CompletableFuture.supplyAsync(this::asyncMethod);
      future.thenAccept(result -> IO.println(result));
      IO.println("Prints first");             // prints before the async result
      future.join();                          // Wait for future to complete
  }

  String asyncMethod() {
      try {
          Thread.sleep(10000);
      } catch (InterruptedException e) {
          return "Interrupted";
      }
      return "Data Fetched";
  }
I made the following changes:

1. Move the asynchronous function called in the CompletableFuture to its own method

2. Use Java 25 "instance main method" (see JEP 25: https://openjdk.org/jeps/512)

3. Use Java 25 IO.println() to simplify console output

4. Instead of throwing a fatal exception on interruption, return "Interrupted" immediately.

5. Use future.join() so the main method waits for the future to complete and the "Data fetched" output is printed.

This program can be run directly from source with `java Example.java`. (If you're using Java 24 or a version of Java 25 prior to EA 22, you need to use `java --enable-preview Example.java`)

Here is a modified version of the example that interrupts the thread:

  void main() {
      ExecutorService executor = Executors.newSingleThreadExecutor();
      CompletableFuture<String> future = CompletableFuture.supplyAsync(this::asyncMethod, executor);
      future.thenAccept(result -> IO.println(result));
      IO.println("Prints first");             // prints before the async result
      executor.shutdownNow();
      future.join();                          // Wait for future to complete
  }

  String asyncMethod() {
      try {
          Thread.sleep(10000);
      } catch (InterruptedException e) {
          return "Interrrupted";
      }
      return "Data Fetched";
  }
wpollock•1y ago
In Java 24, new features support educational and demonstration use. You don't need a class to wrap your main method, which also has a simpler signature. To compare JavaScript with Java examples, one should make use of these features.

While the examples may need some work, I enjoyed this post, it nicely shows the evolution of Java concurrency.