# Add annotation (or other mechanism) to force named arguments for method

**URL:** <https://discuss.kotlinlang.org/t/add-annotation-or-other-mechanism-to-force-named-arguments-for-method/15636>\
**Category:** Language Design\
**Created:** [December 28, 2019, 8:51pm UTC](https://discuss.kotlinlang.org/t/add-annotation-or-other-mechanism-to-force-named-arguments-for-method/15636 "2019-12-28T20:51:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gvfiqst](https://avatars.discourse-cdn.com/v4/letter/g/aeb1de/32.png) [@gvfiqst](https://discuss.kotlinlang.org/u/gvfiqst)\
**Post date:** [December 28, 2019, 8:51pm UTC](https://discuss.kotlinlang.org/t/add-annotation-or-other-mechanism-to-force-named-arguments-for-method/15636/1 "2019-12-28T20:51:48Z")

</div>

It would be nice to have some kind of annotation (or other mechanism) which will force caller to use named arguments.

For instance to call this method:

```kotlin
@NamedArgsOnly
fun buildSomeInstance(param1: Boolean = true, param2: Boolean = false /* so on */)

```

Developer will be bound to use named arguments:

```kotlin
buildSomeInstance(param1=false, param2=true)

```

This would be useful for creating builders. It will improve readability

---

<div class="post-metadata">

**Author:** ![Wasabi375](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/wasabi375/32/4741_2.png) [@Wasabi375](https://discuss.kotlinlang.org/u/Wasabi375)\
**Post date:** [December 29, 2019, 1:05am UTC](https://discuss.kotlinlang.org/t/add-annotation-or-other-mechanism-to-force-named-arguments-for-method/15636/2 "2019-12-29T01:05:52Z")

</div>

I like the idea. There already is a similar issue on youtrack: [https://youtrack.jetbrains.com/issue/KT-14934](https://youtrack.jetbrains.com/issue/KT-14934)  
It’s a feature request to decide this for each parameter separate.
