frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Kotlin's Rich Errors: Native, Typed Errors Without Exceptions

https://cekrem.github.io/posts/kotlin-rich-errors-elm-union-types/
17•todsacerdoti•5d ago

Comments

simon_void•4d ago
Rich Errors look promising to me, but what about interop with Java? What will the return-type of a function be on the Java side be, if the return type on Kotlin side is: Int | ParseError | SomeOtherError?

Background: unions aren't restricted to one normal type and one error type, but to one normal type and any number of error types, so this can't be modelled as syntactic sugar on top of an implicit Either/Result type, can it??

pianoben•1h ago
> what about interop with Java?

From the proposal discussion[0], the runtime representation on the JVM will just be `Object`.

[0]: https://github.com/Kotlin/KEEP/discussions/447#discussioncom...

pjmlp•41m ago
Kotlin folks seem to mostly care about Java as bootstrap to their own ecosystem.

The anti-Java bias, against the platform that made it possible in first place and got JetBrains a business, is quite strong on Android, fostered by the team own attitude usually using legacy Java samples vs Kotlin.

cekrem•4d ago
The Java interop compromise is probably the biggest weakness of the proposal - it works beautifully within Kotlin but degrades at boundaries. This is similar to how Kotlin's nullable types (String?) become platform types in Java.

I think it's good nonetheless to add stuff to Kotlin that won't translate 1:1 to Java, both because Java is evolving but also because Kotlin is used in "Native" (non-JVM) contexts as well (not extensively, but hopefully that'll change).

pjmlp•44m ago
That is always the gotcha with guest languages.

C++ cannot get away from C, Typescript cannot get away from JavaScript, and so forth.

armchairhacker•1h ago
These remind me of checked exceptions in Java. Ironically, Kotlin removed checked exceptions because they tend to be annoying more than useful: there's no clear guideline to whether an exception is checked or unchecked, some functions like IO and reflection have them while others don't, they're verbose especially when closures are involved, and lots of functions simply catch and rethrow checked exceptions in unchecked exceptions.

Which leads me to: why is Kotlin implementing this in a non-JVM compatible way, instead of introducing checked exceptions with better language support? All the problems stated above can be avoided while keeping the core idea of checked exceptions, which seems to be the same as this proposal.

From the GitHub discussion, I see this comment (https://github.com/Kotlin/KEEP/discussions/447#discussioncom...):

> The difference between checked exceptions from java and error unions in this proposal is how they are treated. Checked exceptions are exceptions and always interrupt the flow of execution. On the other hand, errors in this proposal are values and can be passed around as values or intentionally ignored or even aggregated enabling the ability to use them in async and awaitAll etc.

But is this a real difference or something that can be emulated mostly syntactically and no deeper than Kotlin's other features (e.g. nullables, getters and setters)? Checked exceptions are also values, and errors can be caught (then ignored or aggregated) but usually interrupt the flow of execution and get propagated like exceptions.

sirwhinesalot•51m ago
Exceptions are cheap on the happy path and super expensive on the error path.

Checked exceptions only make sense for errors that are relatively common (i.e., they aren't really exceptional), which calls for a different implementation entirely where both the happy path and the error path have around the same cost.

This is what modern languages like Rust and Go do as well (and I think Swift as well though don't quote me on that) where only actually exceptional situations (like accessing an array out of bounds) trigger stack unwinding. Rust and Go call these panics but they are implemented like exceptions.

Other errors are just values. They have no special treatment besides syntax sugar. They are a return value like any other and have the same cost. As they aren't exceptional (you need to check them for a reason), it makes no sense to use the exception handling mechanism for them which has massively skewed costs.

esafak•15m ago
Slated for release in 2.4 the coming summer. Track in https://youtrack.jetbrains.com/issue/KT-68296

Proof of Corn

https://proofofcorn.com/
153•rocauc•1h ago•104 comments

Claude.ai silently failing since Jan 14, no official acknowledgment

https://github.com/anthropics/claude-code/issues/18866
76•nurimamedov•1h ago•39 comments

Microsoft gave FBI set of BitLocker encryption keys to unlock suspects' laptops

https://techcrunch.com/2026/01/23/microsoft-gave-fbi-a-set-of-bitlocker-encryption-keys-to-unlock...
257•bookofjoe•1h ago•198 comments

Radicle: The Sovereign Forge

https://radicle.xyz
218•ibobev•6h ago•107 comments

Route leak incident on January 22, 2026

https://blog.cloudflare.com/route-leak-incident-january-22-2026/
38•nomaxx117•1h ago•2 comments

Tesla kills Autopilot, locks lane-keeping behind $99/month fee

https://arstechnica.com/cars/2026/01/tesla-wants-recurring-revenue-discontinues-autopilot-in-favo...
55•CharlesW•24m ago•14 comments

Killing the ISP Appliance: An eBPF/XDP Approach to Distributed BNG

https://markgascoyne.co.uk/posts/ebpf-bng/
28•chaz6•2h ago•9 comments

KORG phase8 – Acoustic Synthesizer

https://www.korg.com/us/products/dj/phase8/
110•bpierre•5h ago•62 comments

AI is a horse (2024)

https://kconner.com/2024/08/02/ai-is-a-horse.html
398•zdw•3d ago•193 comments

Notes on the Intel 8086 processor's arithmetic-logic unit

https://www.righto.com/2026/01/notes-on-intel-8086-processors.html
25•elpocko•2h ago•2 comments

Booting from a vinyl record (2020)

https://boginjr.com/it/sw/dev/vinyl-boot/
228•yesturi•9h ago•73 comments

Show HN: Zsweep – Play Minesweeper using only Vim motions

https://zsweep.com
43•oug-t•5d ago•16 comments

Show HN: Whosthere: A LAN discovery tool with a modern TUI, written in Go

https://github.com/ramonvermeulen/whosthere
153•rvermeulen98•7h ago•58 comments

Proton Spam and the AI Consent Problem

https://dbushell.com/2026/01/22/proton-spam/
418•dbushell•12h ago•260 comments

Show HN: New 3D Mapping website - Create heli orbits and "playable" map tours.

https://www.easy3dmaps.com/gallery
16•dobodob•2h ago•5 comments

I built a light that reacts to radio waves [video]

https://www.youtube.com/watch?v=moBCOEiqiPs
407•codetheweb•14h ago•94 comments

Waypoint-1: Real-Time Interactive Video Diffusion from Overworld

https://huggingface.co/blog/waypoint-1
16•avaer•4h ago•1 comments

Zotero 8

https://www.zotero.org/blog/zotero-8/
61•bouchard•1h ago•8 comments

Nobody likes lag: How to make low-latency dev sandboxes

https://www.compyle.ai/blog/nobody-likes-lag/
9•mnazzaro•2h ago•0 comments

European Alternatives

https://european-alternatives.eu
402•s_dev•6h ago•182 comments

Updates to our web search products and Programmable Search Engine capabilities

https://programmablesearchengine.googleblog.com/2026/01/updates-to-our-web-search-products.html
188•01jonny01•10h ago•162 comments

Gas Town's Agent Patterns, Design Bottlenecks, and Vibecoding at Scale

https://maggieappleton.com/gastown
140•pavel_lishin•3h ago•155 comments

Kotlin's Rich Errors: Native, Typed Errors Without Exceptions

https://cekrem.github.io/posts/kotlin-rich-errors-elm-union-types/
17•todsacerdoti•5d ago•8 comments

Replacing Protobuf with Rust to go 5 times faster

https://pgdog.dev/blog/replace-protobuf-with-rust
158•whiteros_e•10h ago•105 comments

Flying with Photons: Rendering Novel Views of Propagating Light

https://anaghmalik.com/FlyingWithPhotons/
26•pillars•3d ago•9 comments

Show HN: Text-to-video model from scratch (2 brothers, 2 years, 2B params)

https://huggingface.co/collections/Linum-AI/linum-v2-2b-text-to-video
108•schopra909•1d ago•23 comments

Three RCEs in Ilias Learning Management System

https://srlabs.de/blog/breaking-ilias-part-2-three-to-rce
17•hack223•4h ago•3 comments

Capital One to acquire Brex for $5.15B

https://www.reuters.com/legal/transactional/capital-one-buy-fintech-firm-brex-515-billion-deal-20...
373•personjerry•22h ago•304 comments

Show HN: Teemux – Zero-config log multiplexer with built-in MCP server

https://teemux.com/
7•gajus•4h ago•4 comments

I was banned from Claude for scaffolding a Claude.md file?

https://hugodaniel.com/posts/claude-code-banned-me/
700•hugodan•1d ago•605 comments