frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

GLM-5.4: Toward Generalized Coding with Our First Loop Transformer

https://z.ai/blog/glm-5.4
219•foohis•2h ago•97 comments

XNU Linux: Full OS X GUI Userspace on Linux

https://github.com/AFK-surf/xnulinux
397•mmastrac•8h ago•185 comments

Free alternative TV network built from the Internet Archive's forgotten videos

https://spelunkr.tv
603•SockThief•11h ago•110 comments

Yes, 17M lines of Lean is a lot

https://micjm.com/blog/yes-17m-lines-of-lean-is-a-lot/
133•seizethecheese•7h ago•152 comments

A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth

https://www.gpupartner.com/blog/beginners-guide-local-ai-inkling-qwen-unsloth
566•Retell15•15h ago•237 comments

Elixir HLS makes FPGA circuits from functions written in Elixir

https://github.com/elixir-hls/elixir-hls
39•kristianpaul•2d ago•0 comments

The Birds of GTA 6: A Field Guide to Vice City and Leonida's Wildlife

https://www.audubon.org/magazine/birds-of-gta-6-field-guide-vice-city-wildlife
534•gaws•17h ago•279 comments

Masullo on the Riemann Hypothesis

https://johncarlosbaez.wordpress.com/2026/11/22/masullo-on-the-riemann-hypothesis/
249•xiaoyu2006•1d ago•228 comments

Perplexity and Intelligence

https://openai.com/index/perplexity-and-intelligence/
613•acossta•19h ago•406 comments

Cathedral floor emerges in Sudan, revealing one of the biggest medieval churches

https://apnews.com/article/sudan-antiquities-nubia-cathedral-1b16f67da881ee5592de4481ee55c527
271•graemep•4d ago•85 comments

A Partial Evaluator for C

https://phoenix.labri.fr/software/tempo/
76•measurablefunc•7h ago•20 comments

MRAM Basics: How Magnetic Memory Is Replacing Embedded Flash

https://www.allaboutcircuits.com/technical-articles/mram-basics-how-magnetic-memory-is-replacing-...
4•giuliomagnifico•2d ago•0 comments

The next circle of security hell

https://blogs.gentoo.org/mgorny/2026/10/27/the-next-circle-of-security-hell/
5•qtqtqt•56m ago•0 comments

Brake Check: Hijacking Trailer Brakes over Bluetooth

https://elementdigital.com.au/blog/brake-check-trailer-brakes-over-bluetooth/
30•DeepLogin•2d ago•29 comments

Assume People Are Not Interested in Your Blog Post

https://danielsada.tech/blog/assume-people-are-not-interested-in-your-blog-post/
227•dshacker•16h ago•115 comments

Treemap of the Riemann Hypothesis Lean Proof

https://pengowray.github.io/riemann-zeta-proof-visualizer/
106•pengowray•10h ago•38 comments

CollectWise (YC F24) Is Hiring

https://www.ycombinator.com/companies/collectwise/jobs/lgobCse-founding-customer-success-manager
1•OBrien_1107•5h ago

GL.iNet Security Notice 2026-11-20

https://www.gl-inet.com/en-us/blogs/blog/glinet-security-notice-2026-11-20
220•gregsadetsky•13h ago•102 comments

A miniature San Francisco with live buses, planes and boats

https://smallsf.com/
292•dutilh•15h ago•96 comments

The struggle for freedom: How BSD escaped AT&T licensing

https://fosscomics.com/posts/16.%20BSD%20Unix%20Part%206%20-%20The%20Struggle%20for%20Freedom/
130•joonehur•14h ago•42 comments

The Usefulness of Useless Knowledge [pdf] (1939)

https://www.ias.edu/sites/default/files/library/UsefulnessHarpers.pdf
137•hectormauer•14h ago•28 comments

The New Docker: Built to Run on Trust

https://www.docker.com/blog/meet-the-new-docker-built-to-run-on-trust/
56•peer2pay•8h ago•115 comments

LittleBit: Ultra Low-Bit Quantization via Latent Factorization (2025)

https://arxiv.org/abs/2506.13771
55•kakadu•3d ago•9 comments

Nyx, the Oldest Internet Service Provider

https://nyx.net/
144•o_-_o•16h ago•24 comments

Enjoy this guy getting bricked over the detail of towers in GTA6

https://bsky.app/profile/floppyadult.com/post/3n2tgw7rofc2v
54•doener•3h ago•16 comments

Show HN: Drive around my village in 3D

https://cherwellvalleymotorclub.app
44•johnwards•2d ago•38 comments

The Unlicensed Gospel: Wisdom Tree's Bible Games on the Game Boy

https://www.gameboymuseum.com/single-post/the-unlicensed-gospel-wisdom-tree-s-bible-games-on-the-...
56•speckx•3d ago•38 comments

Show HN: I built a game where you are an LLM's subagent

https://github.com/gulivan/worker755
331•ivantgam•22h ago•79 comments

What Happened to Silicon Valley?

https://www.oreilly.com/radar/what-happened-to-silicon-valley/
706•greenyouse•17h ago•381 comments

Toyota, Nissan, and Honda to standardize parts to lower costs

https://www.caranddriver.com/news/a74490092/toyota-nissan-honda-standardize-parts-lower-costs/
1324•zdw•1d ago•710 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.