<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/we-have-named-arguments-at-home-rkawezkub" -->

---
title: We Have Named Arguments at Home | daily.dev
description: Responding to Steve Klabnik's essay on named arguments, this piece argues Rust already provides idiomatic substitutes for named, optional, default, and...
canonical: https://daily.dev/posts/we-have-named-arguments-at-home-rkawezkub
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: We Have Named Arguments at Home | daily.dev
og:description: Responding to Steve Klabnik's essay on named arguments, this piece argues Rust already provides idiomatic substitutes for named, optional, default, and...
og:url: https://daily.dev/posts/we-have-named-arguments-at-home-rkawezkub
og:image: https://api.daily.dev/og/posts/rKaWezKUb.png
og:image:alt: We Have Named Arguments at Home
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# We Have Named Arguments at Home

**[corrode](https://daily.dev/sources/corrode-blog)** · 15 min read · 3 upvotes · 0 comments

## Summary

Responding to Steve Klabnik's essay on named arguments, this piece argues Rust already provides idiomatic substitutes for named, optional, default, and variadic arguments, plus function overloading, without adding new language features. Structs replace named arguments (with field order flexibility, typo checking, and per-field docs), Option and Default cover optional/default arguments, traits and enums handle overloading and flexible input types, slices/iterators substitute for variadics, and field-init shorthand plus struct update syntax reduce boilerplate. The author contends these composable, existing features push developers toward better domain modeling and that Rust's philosophy of moving complexity into the type system rather than function-call syntax produces more maintainable, agent-friendly APIs, while acknowledging real named arguments would still be a nicer, if narrow, syntactic win.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://corrode.dev/blog/named-arguments-at-home>

## Questions this post answers

### How do I emulate named arguments in Rust without a language feature for it?

Use a struct instead of positional parameters. Defining a struct like Crop { x, y, width, height } and passing it as a single argument gives named fields, arbitrary field order, typo checking, autocomplete, and per-field documentation, while the names belong to the type rather than becoming part of the function's calling convention.

_See how daily.dev surfaces Rust API design patterns for developers weighing struct-based APIs versus new syntax._

### How can I implement default argument values in Rust?

Combine the Default trait with struct update syntax. Deriving Default on an options struct and writing RequestOptions { timeout: Some(Duration::from_secs(5)), ..Default::default() } lets callers override only the fields they care about, without any special language-level default-argument syntax or ambiguity about when defaults are evaluated.

_Developers designing configurable Rust APIs use daily.dev to compare idioms like this before committing to one._

### How do I handle variadic-style function arguments in Rust since it has no general variadic functions?

Accept a slice or an iterator instead of variadic parameters. A function signature like fn sum(values: impl IntoIterator<Item = i32>) -> i32 lets callers pass arrays, vectors, or other iterables, which is more composable than a fixed variadic call, is fully type-safe, and has zero runtime indirection.

_Track idiomatic alternatives like this on daily.dev when designing flexible, type-safe Rust function signatures._

## Community take

How the wider developer community reacted, aggregated from 2 discussions and 30 comments across lobsters, hackernews (as of 2026-09-24).

**TL;DR:** Discussion is split on whether Rust's struct-based workarounds for named/optional arguments are a genuine design win or just boilerplate-laden cope, with several concrete counter-proposals (default field values, inferred struct names, partial defaults) floated as better fixes.

**Sentiment:** 25% positive · 45% mixed · 30% skeptical

**The case for**

- Some agree that the friction of defining a struct pushes developers to surface genuinely useful, semantically meaningful types.
- A smaller, more orthogonal set of language features is seen as preferable to ever-growing syntax.
- Tooling (IDE parameter hints) is noted as already mitigating some of the readability problems named arguments would solve.

**The pushback**

- Several argue the struct-boilerplate example is much worse ergonomically than real named arguments, calling it 'sour grapes'.
- Critics doubt the claim that friction reliably leads to better APIs rather than just ugly callsites and single-use structs.
- Some feel forcing every function to have its own options struct clutters the API surface, especially when semantics don't naturally share a type.
- One commenter calls the argument 'a lot of cope' and notes structs don't cleanly support optional-vs-default distinctions or variadic forwarding.

**By community**

- lobsters (mixed): Long, detailed thread split between defenders of Rust's type-driven approach and critics who see the struct workaround as awkward boilerplate, alongside several concrete alternative feature proposals.
- hackernews (mixed): Only a single low-signal comment pointing to the original Klabnik essay for context, offering no real take.

**Hottest debate:** Whether requiring a dedicated options struct for named/optional parameters genuinely improves API design or is just awkward boilerplate dressed up as a virtue.

**Open questions**

- Should functions with similar parameter names share a single struct type, or is duplication acceptable?
- How should Rust properly support a mix of required and optional/defaulted struct fields without extra boilerplate?
- Would adding real named arguments to Rust inevitably force in defaults and overloading too, or can it stay narrow?

**Highlights**

> OP says instead of this, ``` request(url, follow_redirects: false); ``` all you have to do is this: ``` struct RequestOptions {     timeout: Duration,     follow_redirects: bool, } impl Default for RequestOptions {     fn default() -> Self {         Self {             timeout: Duration::from_secs(30),             follow_redirects: true,         }     } } request(     url,     RequestOptions {         follow_redirects: false,         ..Default::default()     }, ); ``` This is supposed to be good code?? I don't see how people can look at struct constructors and think that it's useful and convenient to have named field initializers and default values, but believe that actually it's bad to have those features for function arguments. Why should the programmer have to write 12 lines of horrendous boilerplate code and pollute their namespace and every call site with a `FooOptions` struct (or worse, use a builder pattern)? It's pure Sour Grapes to think that's actually better than named arguments.
> — [spillybones on lobsters · 2 points, 1 comments](https://lobste.rs/s/4cbau4/we_have_named_arguments_at_home#c_bdccu5)

> > you can't seriously say this about Rust, a very complex language; the extra complexity isn't much compared to what's already in there. Keeping an eye on the complexity budget to stave off becoming the next C++ "just one more little thing" at a time has been deep in Rust's RFC process since the beginning. Hell, Rust RFCs were I learned the adjective "didactic" and the phrase "complexity budget" and the sentiment that Rust had already blown its complexity budget on ownership and borrowing and that all further additions must be viewed warily. > The gain is IMO very real - you get a nice API without it becoming a design problem I disagree. A big part of the thesis of the post is that things like Ruby's `redirect_to` *are* design problems. ("These calls look like they’re invoking one conceptual operation, but they mean wildly different things.") Another core element of Rust's design philosophy from the beginning has been "Code gets read much more than it gets written". > in practice instead of thoughtful workarounds creating generally useful types you will simply get bad APIs with ugly callsites most of the time. I'm going to have to call [citation needed] on this one.
> — [ssokolow on lobsters · 3 points](https://lobste.rs/s/4cbau4/we_have_named_arguments_at_home#c_gkuhvh)

> Right - the examples in the article (things like Size, etc) are reasonable, but in many cases that's not what you have so you litter your API surface with myriad single use structs. The more I think about it, the more I realize is that the problem is the labeled parameters are seen as a property the parameter, rather than as part of the _function name_. e.g     fn foo(a:u32)     foo(a:1)     let foo_ref = foo; // I can't recall rust syntax is considered a call to a function named `foo`. In languages like objective-c the "parameter name" is actually part of the function's name. e.g.     func foo(a:Int)     foo(a:1);     let foo_ref = foo(a:) so it is essentially the standard `operation_arg1_arg2(...)` scheme C uses for "overloading", only the parameters in semantically relevant locations rather than disconnected from the parameter description.
> — [olliej on lobsters · 1 points, 1 comments](https://lobste.rs/s/4cbau4/we_have_named_arguments_at_home#c_flisbw)

> A lot of cope. Reads like the sort of article the Go community would write... Speaking as someone that loves Go.  The point of optional arguments is that a predetermined default value is used if nothing is passed, passing `none` is not the same as passing nothing since none is a value in languages like Rust and Python. Using structs for keyword arguments though is more palatable, even though it probably bundles the values together more than you'd like, and eliminates any method of capturing and forwarding the named arguments in variadic packs.
> — [melodyogonna on lobsters · 1 points](https://lobste.rs/s/4cbau4/we_have_named_arguments_at_home#c_temucy)

> I used to be in the camp for keyword/optional arguments, but thinking about it more I've changed my mind completely. After seeing the implications of making parameter names part of the public API, I don't think the complexity of expressing that is worth it. Not to mention, the default values of optional arguments are also practically part of the public API, but that fact is hidden almost by definition. I tend to agree that it's enough to semantically group related parameters into their own type. It makes writing callsites inconvenient, but isn't it nice to look at a function call and be able to intuit what it's doing, even if it's verbose? It's true that people won't naturally do this, especially for functions with just a few parameters. But I think the reverse is true too, where keyword arguments passively encourage people to write god functions that force you to read the docs anyways.
> — [ancienthero on lobsters · 1 points](https://lobste.rs/s/4cbau4/we_have_named_arguments_at_home#c_bpsjdf)

**Source threads**

- [lobsters](https://lobste.rs/s/4cbau4/we_have_named_arguments_at_home) · 49 points · 28 comments
- [hackernews](https://news.ycombinator.com/item?id=49833702) · 2 points · 2 comments

## Similar posts on daily.dev

- [Named and Optional Arguments are Awesome](https://daily.dev/posts/named-and-optional-arguments-are-awesome-ndmndouei) · Lobsters · 0 upvotes · 0 comments
- [Arguing about arguments](https://daily.dev/posts/arguing-about-arguments-pajlneklj) · Steve Klabnik · 0 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#rust](https://daily.dev/tags/rust)

[View this post on daily.dev](https://daily.dev/posts/we-have-named-arguments-at-home-rkawezkub)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"We Have Named Arguments at Home","url":"https://daily.dev/posts/we-have-named-arguments-at-home-rkawezkub","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/we-have-named-arguments-at-home-rkawezkub"},"datePublished":"2026-09-24T16:27:42.035Z","dateModified":"2026-09-24T22:58:37.909Z","description":"Responding to Steve Klabnik's essay on named arguments, this piece argues Rust already provides idiomatic substitutes for named, optional, default, and...","image":"https://media.daily.dev/image/upload/s--1KxV4ohY--/f_auto/v1722860400/public/Placeholder%2007","thumbnailUrl":"https://media.daily.dev/image/upload/s--1KxV4ohY--/f_auto/v1722860400/public/Placeholder%2007","isAccessibleForFree":true,"articleSection":"corrode","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"corrode","logo":"https://media.daily.dev/image/upload/s--pI2ONj8J--/f_auto,q_auto/v1780213709/logos/corrode-blog?_a=BAMAMiWQ0","url":"https://daily.dev/sources/corrode-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/we-have-named-arguments-at-home-rkawezkub","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"architecture,rust","timeRequired":"PT15M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"corrode","item":"https://daily.dev/sources/corrode-blog"},{"@type":"ListItem","position":3,"name":"We Have Named Arguments at Home"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/we-have-named-arguments-at-home-rkawezkub#faq","mainEntity":[{"@type":"Question","name":"How do I emulate named arguments in Rust without a language feature for it?","acceptedAnswer":{"@type":"Answer","text":"Use a struct instead of positional parameters. Defining a struct like Crop { x, y, width, height } and passing it as a single argument gives named fields, arbitrary field order, typo checking, autocomplete, and per-field documentation, while the names belong to the type rather than becoming part of the function's calling convention. See how daily.dev surfaces Rust API design patterns for developers weighing struct-based APIs versus new syntax."}},{"@type":"Question","name":"How can I implement default argument values in Rust?","acceptedAnswer":{"@type":"Answer","text":"Combine the Default trait with struct update syntax. Deriving Default on an options struct and writing RequestOptions { timeout: Some(Duration::from_secs(5)), ..Default::default() } lets callers override only the fields they care about, without any special language-level default-argument syntax or ambiguity about when defaults are evaluated. Developers designing configurable Rust APIs use daily.dev to compare idioms like this before committing to one."}},{"@type":"Question","name":"How do I handle variadic-style function arguments in Rust since it has no general variadic functions?","acceptedAnswer":{"@type":"Answer","text":"Accept a slice or an iterator instead of variadic parameters. A function signature like fn sum(values: impl IntoIterator\u003cItem = i32\u003e) -\u003e i32 lets callers pass arrays, vectors, or other iterables, which is more composable than a fixed variadic call, is fully type-safe, and has zero runtime indirection. Track idiomatic alternatives like this on daily.dev when designing flexible, type-safe Rust function signatures."}}]}
```

