frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Saudi Arabia, Turkey and Pakistan Sign Defense Pact

https://www.wsj.com/world/middle-east/saudi-arabia-turkey-and-pakistan-sign-defense-pact-ba80d84d
1•JumpCrisscross•51s ago•0 comments

Show HN: Squaredle 2 – browser-local word-grid practice and solver

https://squaredle2.org/
1•lby910722•1m ago•0 comments

Project Kalos – Zero-copy C/CUDA sidecar for 0.46ms LLM memory recall

https://github.com/MongooseReborn/kalos-engine
1•mongoosereborn•1m ago•0 comments

Worried about your blood pressure? A $399 Ring measures it without a cuff

https://www.inc.com/connor-jewiss/worried-about-your-blood-pressure-a-399-ring-wants-to-measure-i...
1•brandonb•1m ago•0 comments

Bloomberg "Some 64% of Young Men Day Trading Stocks Feel Like Failures"

https://finance.yahoo.com/markets/stocks/articles/64-young-men-day-trading-131731246.html
1•valgaze•3m ago•0 comments

The AI Billboards Are Killing SF

https://sfstandard.com/pacific-standard-time/2026/08/07/sf-ai-billboards-dystopian-not-funny/
1•danorama•4m ago•0 comments

ByteDance targets mega AI model nearing Anthropic's Mythos

https://www.ft.com/content/9b8383b1-a28d-4940-8c4e-2f0cd21556ef
1•JumpCrisscross•4m ago•0 comments

Carr's FCC Rewrites Media Ownership Law Only Congress Can Change

https://www.techdirt.com/2026/08/07/brendan-carrs-fcc-rewrites-media-ownership-law-only-congress-...
1•hn_acker•4m ago•1 comments

Moving the Microsoft Edge extensions ecosystem forward with Manifest Version 3

https://blogs.windows.com/msedgedev/2026/08/07/moving-the-microsoft-edge-extensions-ecosystem-for...
1•cpeterso•4m ago•1 comments

The Case Against Perfection (2004)

https://www.theatlantic.com/magazine/archive/2004/04/the-case-against-perfection/302927/
1•geneticdrifts•4m ago•0 comments

Newly discovered demon cavefish may be among the rarest fish in the world

https://www.cnn.com/2026/07/31/science/demon-cavefish-species-discovery
1•mooreds•6m ago•0 comments

Jujutsu 0.44.0

https://docs.jj-vcs.dev/latest/changelog/
2•tosh•6m ago•0 comments

Wi-Fi 7 adoption in the US quadrupled in a year – is it time to upgrade?

https://www.zdnet.com/home-and-office/networking/wifi-7-adoption-in-us-quadrupled-in-year-time-to...
1•CrankyBear•7m ago•0 comments

Show HN: Hirenewtalent.ai – Hire offshore in minutes via API

https://hirenewtalent.ai/
1•jaikannan1•7m ago•0 comments

How the Underground (of Seattle) Came to Be

https://undergroundtour.com/history/
1•mooreds•8m ago•0 comments

Ask HN: What are your favorite free daily web-based games?

1•DamnInteresting•9m ago•0 comments

Show HN: ADE syncs all your coding agents between web, mobile, and CLI

https://www.ade-app.dev
1•arul28•10m ago•0 comments

Three Myths People Love to Believe About English

https://www.nytimes.com/2026/08/06/opinion/english-language-linguistics-myths.html
2•Michelangelo11•16m ago•0 comments

State Department Wants Palantir's Advice on Free Speech

https://theintercept.com/2026/08/07/state-department-palantir-free-speech-surveillance/
11•cdrnsf•17m ago•2 comments

U.S. Intel Finds Putin Could Test NATO's Resolve with Limited Incursion

https://www.wsj.com/world/europe/u-s-intel-finds-putin-could-test-natos-resolve-with-limited-incu...
6•cwwc•19m ago•0 comments

Show HN: Agent Monitor – Monitor Your Coding Agent Live

https://agent-monitor.ai/
1•gsibble•21m ago•0 comments

Tlbic v10.1 French Supplement: A local basic income model for systemic despair

https://drive.google.com/file/d/1MGFLYnYyVzWV_H4NsAKc1_yA_dToxzUz/view?usp=drive_link
1•michikawa59•21m ago•1 comments

This Mine Predicts Major Wars. It's Opening Again

https://www.bloomberg.com/graphics/2026-opinion-australia-tungsten-mine-us-war-defense-china/
4•mooreds•21m ago•0 comments

Ask HN: Are You Preparing for the Singularity

1•blululu•22m ago•1 comments

Size the Orbs of Production

https://ampcode.com/news/size-the-orbs-of-production
2•tosh•22m ago•0 comments

India Test-Fires 4,000KM Agni-4 Nuclear Missile

https://defencesecurityasia.com/en/india-agni-4-nuclear-missile-test-china-indo-pacific/
2•Teever•23m ago•0 comments

Hand-coding will never die

https://christinacodes.dev/writing/hand-coding-will-never-die/
1•vinhnx•23m ago•1 comments

Engineering Culture Trends 2026 – Food for Agile Thought #556

https://age-of-product.com/food-agile-thought-556-engineering-culture-trends-2026/
1•swolpers•24m ago•0 comments

Show HN: Infinite scrolling comes to Hazumi for Hacker News

https://apps.apple.com/us/app/hazumi-for-hacker-news/id1670237209
1•jrhey•24m ago•0 comments

The Life and Times of Maxis, Part 3: The Sims

https://www.filfre.net/2026/08/the-life-and-times-of-maxis-part-3-the-sims/
2•doppp•26m ago•0 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.