Login
You're viewing the techdon.dev public feed.
  • Nov 13, 2026, 12:03 PM

    New blog post: A `by`-based delegation notation

    blog.yoshuawuyts.com/a-by-base

    Rust’s lang team recently discussed a proposal to add delegation to the language based on the `reuse` keyword. While the semantics are quite good, I am less sure about the notation. So in this post I explore what it could look like if Rust implemented delegation by borrowing Kotlin’s `by` notation instead.

    💬 1🔄 0⭐ 0

Replies

  • 💬 2🔄 0⭐ 0
  • Nov 13, 2026, 2:51 PM

    @jhpratt @yosh I would prefer not having this in the language at all and instead allow compile time reflection to handle it (ref. the talk by @oli at EuroRust), reuse of a function implem seems like something logical to implement that way to me

    💬 0🔄 0⭐ 0
  • Nov 13, 2026, 3:11 PM

    @poliorcetics @jhpratt @oli

    Ah yeah, I saw the VOD of that was posted just a few days ago, but I haven't watched it yet. I will now tho!

    My hope is that both features could be made to coexist tho, and maybe optimize for different use cases. Maybe even share ways in which they can be applied within the language? I certainly don't want it to feel like both features are competing for the same use cases tho; that would be bad.

    💬 1🔄 0⭐ 0
  • Nov 13, 2026, 3:47 PM

    @poliorcetics @jhpratt @oli

    Ok, watched the talk. Nothing unexpected there except being roasted for some of my other ideas lmao (comptime file system read/writes).

    I could totally see something like `fn foo by comptime_fn` work to essentially give us what derives from macros give us today. And I don't think there would be any compat issues with also doing some of the other delegation work. Maybe delegation itself could actually even be implemented in terms of comptime internally?

    💬 1🔄 0⭐ 0
  • Nov 13, 2026, 5:50 PM

    @yosh @poliorcetics @jhpratt it was hilarious how right after the talk security folk came to me and were like "reading files is dangerous, have you thought this through"😅

    My UX plans thoroughly resolve all security concerns apparently, so all is well

    💬 0🔄 0⭐ 1
  • 💬 0🔄 0⭐ 0
  • Nov 13, 2026, 3:01 PM

    @jhpratt `as` has the inverse operand order:

    pub fn foo as bar

    You'd expect "foo" to be the name of the exported function here, not "bar". Unless you take something closer to the Scala route, which is basically what the `reuse` notation does.

    💬 0🔄 0⭐ 0