# Why isn't JuMP.register named register!

**URL:** https://discourse.julialang.org/t/why-isnt-jump-register-named-register/87456
**Category:** Optimization (Mathematical)
**Tags:** jump
**Created:** [September 19, 2022, 4:21am UTC](https://discourse.julialang.org/t/why-isnt-jump-register-named-register/87456 "2022-09-19T04:21:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [September 19, 2022, 4:21am UTC](https://discourse.julialang.org/t/why-isnt-jump-register-named-register/87456/1 "2022-09-19T04:21:20Z")

</div>

[`register`](https://jump.dev/JuMP.jl/stable/reference/nlp/#JuMP.register) modifies its argument model, so the function would normally end in `!`. Why isn’t this function named `register!`?

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [September 19, 2022, 4:25am UTC](https://discourse.julialang.org/t/why-isnt-jump-register-named-register/87456/2 "2022-09-19T04:25:20Z")

</div>

The JuMP style guide covers this: [Style Guide · JuMP](https://jump.dev/JuMP.jl/stable/developers/style/#Use-of-!).

---

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [September 19, 2022, 5:36am UTC](https://discourse.julialang.org/t/why-isnt-jump-register-named-register/87456/3 "2022-09-19T05:36:23Z")

</div>

> Omit `!` when the name itself makes it clear that modification is taking place, e.g., `add_constraint` and `set_name`. We depart from the Julia style guide because `!` does not provide a reader with any additional information in this case, and adherence to this convention is not uniform even in base Julia itself (consider `Base.println` and `Base.finalize`).

For what it’s worth — I normally expect a function like `sort` to return a modified value without actually mutating the argument. I imagine a functional API like this could exist for JuMP too, so I was surprised to see `register` used with no return value. So I’m not sure the name tells users what the function does if they don’t already know, especially in the context of such a strong convention.

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [September 19, 2022, 5:57am UTC](https://discourse.julialang.org/t/why-isnt-jump-register-named-register/87456/4 "2022-09-19T05:57:17Z")

</div>

> [@jar1](#):
>
> I imagine a functional API like this could exist for JuMP too

Unfortunately not. Mutation is a core part of the design, so there will probably never be a purely functional API to JuMP.
