frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

John Ternus to become Apple CEO

https://www.apple.com/newsroom/2026/04/tim-cook-to-become-apple-executive-chairman-john-ternus-to...
1734•schappim•12h ago•885 comments

Anthropic says OpenClaw-style Claude CLI usage is allowed again

https://docs.openclaw.ai/providers/anthropic
159•jmsflknr•4h ago•87 comments

A Roblox cheat and one AI tool brought down Vercel's platform

https://webmatrices.com/post/how-a-roblox-cheat-and-one-ai-tool-brought-down-vercel-s-entire-plat...
134•bishwasbh•4h ago•56 comments

Louis Zocchi, inventor of the d100, has died

https://icv2.com/articles/news/view/62176/r-i-p-louis-zocchi-the-godfather-dice
30•sgbeal•2h ago•7 comments

The Beauty of Bonsai Styles

https://longwoodgardens.org/blog/2023-05-17/beauty-bonsai-styles
53•lagniappe•4h ago•14 comments

How to make a fast dynamic language interpreter

https://zef-lang.dev/implementation
158•pizlonator•7h ago•21 comments

Salmon exposed to cocaine and its main byproduct roam more widely

https://www.science.org/content/article/cocaine-pollution-gives-salmon-wanderlust
18•1659447091•3h ago•4 comments

Show HN: Mediator.ai – Using Nash bargaining and LLMs to systematize fairness

https://mediator.ai/
53•sanity•17h ago•26 comments

Qwen3.6-Max-Preview: Smarter, Sharper, Still Evolving

https://qwen.ai/blog?id=qwen3.6-max-preview
618•mfiguiere•18h ago•326 comments

How a subsea cable is repaired

https://www.onesteppower.com/post/subsea-cable-repair
60•slicktux•4d ago•12 comments

Kimi vendor verifier – verify accuracy of inference providers

https://www.kimi.com/blog/kimi-vendor-verifier
253•Alifatisk•13h ago•21 comments

Types and Neural Networks

https://www.brunogavranovic.com/posts/2026-04-20-types-and-neural-networks.html
14•bgavran•2h ago•3 comments

A mad undertaking: An undefinitive guide to the Aadam Jacobs collection

https://aadamjacobscollection.org/
11•wise_blood•2h ago•1 comments

Ternary Bonsai: Top Intelligence at 1.58 Bits

https://prismml.com/news/ternary-bonsai
140•nnx•3d ago•40 comments

Jujutsu megamerges for fun and profit

https://isaaccorbrey.com/notes/jujutsu-megamerges-for-fun-and-profit
220•icorbrey•11h ago•105 comments

Tim Davis – Probabilistic engineering and the 24-7 employee

https://www.timdavis.com/blog/probabilistic-engineering-and-the-24-7-employee
31•kiyanwang•1d ago•12 comments

Air is full of DNA

https://www.nature.com/articles/d41586-026-01099-2
87•howrude•2d ago•18 comments

ggsql: A Grammar of Graphics for SQL

https://opensource.posit.co/blog/2026-04-20_ggsql_alpha_release/
408•thomasp85•19h ago•80 comments

MNT Reform is an open hardware laptop, designed and assembled in Germany

http://mnt.stanleylieber.com/reform/
3•speckx•18h ago•0 comments

Japan's cherry blossom database, 1,200 years old, has a new keeper

https://www.nytimes.com/2026/04/17/climate/japan-cherry-blossom-database-scientist.html
96•caycep•3d ago•11 comments

Quantum Computers Are Not a Threat to 128-Bit Symmetric Keys

https://words.filippo.io/128-bits/
219•hasheddan•16h ago•78 comments

Using Changesets in a polyglot monorepo

https://luke.hsiao.dev/blog/changesets-polyglot-monorepo/
7•lwhsiao•2h ago•3 comments

Brussels launched an age checking app. Hackers took 2 minutes to break it

https://www.politico.eu/article/eu-brussels-launched-age-checking-app-hackers-say-took-them-2-min...
216•axbyte•23h ago•110 comments

Monero Community Crowdfunding System

https://ccs.getmonero.org/ideas/
89•OsrsNeedsf2P•11h ago•53 comments

Soul Player C64 – A real transformer running on a 1 MHz Commodore 64

https://github.com/gizmo64k/soulplayer-c64
122•adunk•12h ago•31 comments

All phones sold in the EU to have replaceable batteries from 2027

https://www.theolivepress.es/spain-news/2026/04/20/eu-to-force-replaceable-batteries-in-phones-an...
1218•ramonga•18h ago•1005 comments

Modern Rendering Culling Techniques

https://krupitskas.com/posts/modern_culling_techniques/
141•krupitskas•2d ago•33 comments

Bullshit About Bullshit Machines [pdf]

https://aphyr.com/data/posts/411/the-future-of-everything-is-lies.pdf
14•hedayet•2d ago•2 comments

Prediction markets are breaking the news and becoming their own beat

https://www.niemanlab.org/2026/04/prediction-markets-are-breaking-the-news-and-becoming-their-own...
38•gnabgib•6h ago•40 comments

Kefir C17/C23 Compiler

https://sr.ht/~jprotopopov/kefir/
150•conductor•3d ago•14 comments
Open in hackernews

Understanding Java's Asynchronous Journey

https://amritpandey.io/understanding-javas-asynchronous-journey/
17•hardasspunk•11mo ago

Comments

Neywiny•11mo 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•11mo 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•11mo 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•11mo 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•11mo 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•11mo 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•11mo 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();
wpollock•11mo 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.

AtlasBarfed•11mo 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•11mo 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";
  }