frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

The Algebra of Loans in Rust

https://nadrieril.github.io/blog/2025/12/21/the-algebra-of-loans-in-rust.html
57•g0xA52A2A•3d ago

Comments

the__alchemist•3d ago
I have what I thought was a broad knowledge base of rust an experience in it over many domains, but I haven't heard of most of those. Have been getting by with `&`, and `&mut` only from those tables!

Incidentally, I think this is one of Rust's best features, and I sorely miss it in Python, JS and other languages. They keep me guessing whether a function will mutate the parent structure, or a local copy in those languages!

Incidentally, I recently posted in another thread here how I just discovered the 'named loop/scope feature, and how I thought it was great, but took a while to discover. A reply was along the effect of "That's not new; it's a common feature". Maybe I don't really know rust, but a dialect of it...

mring33621•3d ago
I'm just learning Rust but so far, it looks like the author is proposing some of these ref types, like &own and &uninit.

I don't know 100% for sure. It's a bit confusing...

jojomodding•1h ago
The part of the blog post where it says

> What’s with all these new reference types? > All of these are speculative ideas

makes it pretty clear to me that they are indeed not yet part of Rust but instead something people have been thinking about adding. The rest of the post discusses how these would work if they were implemented.

whytevuhuni•1h ago
Right. The &pin, &own, and &uninit in the article (or rather everything except & and &mut in that table) do not exist in Rust.

I have seen &pin being proposed recently [1], first time I'm seeing the others.

[1] https://blog.rust-lang.org/2025/11/19/project-goals-update-o...

VorpalWay•38m ago
Own and uninit have been in discussions wrt in place construction. The Rust in the Linux kernel project seems to be the motivating use case for this that really got the effort going recently.
GardenLetter27•1h ago
Rust gives you no guarantees that a function won't allocate or panic though.
MaulingMonkey•1h ago
This is something I do wish Rust could better support. A `#![no_std]` library crate can at least discourage allocation (although it can always `extern crate alloc;` in lib.rs or invoke malloc via FFI...)
maxbond•55m ago
Is the juice worth the squeeze to introduce two new function colors? What would you do if you needed to call `unreachable!()`?

It's a shame that you can't quite do this with a lint, because they can't recurse to check the definitions of functions you call. That would seem to me to be ideal, maintain it as an application-level discipline so as not to complicate the base language, but automate it.

MaulingMonkey•26m ago
> Is the juice worth the squeeze to introduce two new function colors?

Typically no... which is another way of saying occasionally yes.

> What would you do if you needed to call `unreachable!()`?

Probably one of e.g.:

    unsafe { core::hint::unreachable_unchecked() }
    loop {}
Which are of course the wrong habits to form! (More seriously: in the contexts where such no-panic colors become useful, it's because you need to not call `unreachable!()`.)

> It's a shame that you can't quite do this with a lint, because they can't recurse to check the definitions of functions you call. That would seem to me to be ideal, maintain it as an application-level discipline so as not to complicate the base language, but automate it.

Indeed. You can mark a crate e.g. #![deny(clippy::panic)] and isolate that way, but it's not quite the rock solid guarantees Rust typically spoils us with.

VorpalWay•34m ago
Yes that is annoying, but I don't know of any mainstream systems language that does. C and C++ can also have allocations anywhere, and C++ have exceptions. And those are really the only competitors to Rust for what I do (hard realtime embedded).

Zig might be an option in the future, and it does give more control over allocations. I don't know what the exception story is there, and it isn't memory safe and doesn't have RAII so I'm not that interested myself at this point.

I guess Ada could be an option too, but I don't know nearly enough about it to say much.

jibal•9m ago
Zig doesn't have exceptions, it has error unions, so basically functions return either a value or an error code and the caller is forced by the language to note which was returned. And instead of RAII it has defer ... which of course can easily be forgotten or mis-scoped, so it's not safe.
goku12•1h ago
I doubt that anybody truly knows Rust. And this is aggravated by the fact that features keep getting added. But here are two simple strategies that I found very effective in keeping us ahead of the curve.

1. Always keep the language reference with you. It's absolutely not a replacement for a good introductory textbook. But it's an unusually effective resource for anybody who has crossed that milestone. It's very effective in spontaneously uncovering new language features and in refining your understanding of the language semantics.

What we need to do with it is to refer it occasionally for even constructs that you're familiar with - for loops, for example. I wish that it was available as auto popups in code editors.

2. Use clippy, the linter. I don't have much to add here. Your code will work without it. But for some reason, clippy is an impeccable tutor into idiomatic Rust coding. And you get the advantage of the fact that it stays in sync with the latest language features. So it's yet another way to keep yourself automatically updated with the language features.

VorpalWay•41m ago
I feel like other languages also have the issue of complexity and changing over time. I doubt I know all of C++ post C++14 for example (even though that is my day job). Keeping up with all the things they throw into the standard library of Python is also near impossible unless you write python every day.

Rust has an unusually short release cycle, but each release tends to have fewer things in it. So that is probably about the same when it comes to new features per year in Python or C++.

But sure, C moves slower (and is smaller to begin with). If that is what you want to compare against. But all the languages I work with on a daily basis (C++, Python and Rust) are sprawling.

I don't have enough experience to speak about other languages in depth, but as I understand it Haskell for example has a lot of extensions. And the typescript/node ecosystem seems to move crazy fast and require a ton of different moving pieces to get anything done (especially when it comes to the build system with bundlers, minifiers and what not).

jacquesm•26m ago
Languages should be small, not large. I find that every language I've ever used that tries to throw everything and the kitchensink at you eventually deteriorates into a mess that spills over into the projects based on that language in terms of long term instability. You should be able to take a 10 year old codebase, compile it and run it. Backwards compatibility is an absolute non-negotiable for programming languages and if you disagree with that you are building toys, not production grade systems.
aw1621107•13m ago
> Backwards compatibility is an absolute non-negotiable for programming languages

What programming language(s) satisfy this criteria, if any?

kreetx•12m ago
Haskell's user-facing language gets compiled down to Haskell "core" which is what the language actually can do. So any new language feature has a check in with sanity when that first transformation gets written.
gucci-on-fleek•18m ago
I don't know Rust at all, but all your comments

> I doubt that anybody truly knows <language>.

> Always keep the language reference with you.

> Use <tool>, the linter.

seem like they apply to all languages (and I agree that they're great advice!).

the8472•1h ago
> All of these are speculative ideas, but at this point they’ve been circulating a bunch so should be pretty robust.
VorpalWay•53m ago
Many of the things like "&own" are ideas being discussed, they don't exist in the language yet. As far as I know only &, &mut and raw pointers (mut and const) exist in stable rust at this point. The standard library has some additional things like NonNull, Rc, etc.
jibal•22m ago
> I sorely miss it in Python, JS and other languages. They keep me guessing whether a function will mutate the parent structure, or a local copy in those languages!

Python at least is very clear about this ... everything, lists, class instances, dicts, tuples, strings, ints, floats ... are all passed by object reference. (Of course it's not relevant for tuples and scalars, which are immutable.)

The Algebra of Loans in Rust

https://nadrieril.github.io/blog/2025/12/21/the-algebra-of-loans-in-rust.html
57•g0xA52A2A•3d ago•20 comments

Maybe the default settings are too high

https://www.raptitude.com/2025/12/maybe-the-default-settings-are-too-high/
661•htk•13h ago•210 comments

Geometric Algorithms for Translucency Sorting in Minecraft [pdf]

https://douira.dev/assets/document/douira-master-thesis.pdf
24•HeliumHydride•2h ago•12 comments

Building an AI agent inside a 7-year-old Rails monolith

https://catalinionescu.dev/ai-agent/building-ai-agent-part-1/
58•cionescu1•4h ago•16 comments

MiniMax M2.1: Built for Real-World Complex Tasks, Multi-Language Programming

https://www.minimaxi.com/news/minimax-m21
160•110•11h ago•54 comments

TurboDiffusion: 100–200× Acceleration for Video Diffusion Models

https://github.com/thu-ml/TurboDiffusion
112•meander_water•9h ago•20 comments

Show HN: Gaming Couch – a local multiplayer party game platform for 8 players

https://gamingcouch.com
244•ChaosOp•4d ago•71 comments

Tiled Art

https://tiled.art/en/home/?id=SilverAndGold
169•meander_water•1w ago•10 comments

Fahrplan – 39C3

https://fahrplan.events.ccc.de/congress/2025/fahrplan/
292•rurban•17h ago•101 comments

Python 3.15’s interpreter for Windows x86-64 should hopefully be 15% faster

https://fidget-spinner.github.io/posts/no-longer-sorry.html
374•lumpa•23h ago•126 comments

How to Reproduce This Book with LaTeX

https://github.com/BenjaminGor/Latex_Notes_Tutorial
25•nill0•6d ago•4 comments

Hardware Touch, Stronger SSH

https://www.ubicloud.com/blog/hardware-touch-stronger-ssh
9•furkansahin•4d ago•2 comments

The entire New Yorker archive is now digitized

https://www.newyorker.com/news/press-room/the-entire-new-yorker-archive-is-now-fully-digitized
432•thm•5d ago•58 comments

Show HN: GeneGuessr – a daily biology web puzzle

https://geneguessr.brinedew.bio/
43•brinedew•3d ago•10 comments

Tachyon: High frequency statistical sampling profiler

https://docs.python.org/3.15/library/profiling.sampling.html
71•vismit2000•4d ago•3 comments

Lessons from a year of Postgres CDC in production

https://clickhouse.com/blog/postgres-cdc-year-in-review-2025
43•saisrirampur•6d ago•2 comments

An 11-qubit atom processor in silicon with all fidelities from 99.10% to 99.99%

https://www.nature.com/articles/s41586-025-09827-w
3•giuliomagnifico•5d ago•1 comments

Ask HN: What skills do you want to develop or improve in 2026?

133•meridion•20h ago•196 comments

Ultimate-Linux: Userspace for Linux in Pure JavaScript

https://github.com/popovicu/ultimate-linux
75•radeeyate•9h ago•18 comments

Seven Diabetes Patients Die Due to Undisclosed Bug in Abbott's Glucose Monitors

https://sfconservancy.org/blog/2025/dec/23/seven-abbott-freestyle-libre-cgm-patients-dead/
310•pabs3•11h ago•94 comments

CUDA Tile Open Sourced

https://github.com/NVIDIA/cuda-tile
181•JonChesterfield•6d ago•90 comments

Animating Quines for Larva Labs

https://destroytoday.com/blog/animating-quines-for-larva-labs
17•speckx•3d ago•1 comments

When a driver challenges the kernel's assumptions

http://miod.online.fr/software/openbsd/stories/udl.html
63•todsacerdoti•11h ago•14 comments

Questions engineers should ask future employers in interviews

https://dollardhingra.substack.com/p/questions-software-engineers-should
7•dollardhingra•1h ago•0 comments

Asahi Linux with Sway on the MacBook Air M2 (2024)

https://daniel.lawrence.lu/blog/2024-12-01-asahi-linux-with-sway-on-the-macbook-air-m2/
243•andsoitis•22h ago•247 comments

Archiving Git branches as tags

https://etc.octavore.com/2025/12/archiving-git-branches-as-tags/
115•octavore•3d ago•41 comments

Paperbacks and TikTok

https://calnewport.com/on-paperbacks-and-tiktok/
126•zdw•3d ago•79 comments

The Program 2025 annual review: How much money does an audio drama podcast make?

https://programaudioseries.com/the-program-results-7/
81•I-M-S•3d ago•17 comments

I sell onions on the Internet (2019)

https://www.deepsouthventures.com/i-sell-onions-on-the-internet/
462•sogen•19h ago•134 comments

Show HN: Lamp Carousel – DIY kinetic sculpture powered by lamp heat (2024)

https://evan.widloski.com/posts/spinners/
83•Evidlo•1d ago•14 comments