# Syntax suggestion: end\<control\>

**URL:** <https://discourse.julialang.org/t/syntax-suggestion-end-control/8605>\
**Category:** Internals & Design\
**Created:** [January 26, 2018, 12:26am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605 "2018-01-26T00:26:49Z")\
**Posts on this page:** 14\
**Page:** 3

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [October 15, 2018, 8:49pm UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/41 "2018-10-15T20:49:22Z")

</div>

> [@StefanKarpinski](#):
>
> It’s not the syntax, it’s the fact that Go has a standard format which is applied to code automatically and which has, as far as I know, zero options: there is a single comletely standardized way of writing Go code.

That was one of the bigger reasons why I lost interest in the Go language.

---

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [October 15, 2018, 9:13pm UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/42 "2018-10-15T21:13:16Z")

</div>

This post was temporarily hidden by the community for possibly being off-topic, unfocused, inappropriate, or spammy.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 16, 2018, 6:39am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/43 "2018-10-16T06:39:48Z")

</div>

> [@iwelch](#):
>
> the confusion comes in when the distance between top and bottom increases—with the extreme of the top having scrolled off the screen

Having a block that does not fit on the screen is almost surely code smell in Julia. Instead of expecting the language or an external tool to protect you from this, you should break up your code into smaller functions.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [October 16, 2018, 10:47am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/44 "2018-10-16T10:47:46Z")

</div>

As I said, this is useful mostly for modules and types. You can’t break anything up there.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 16, 2018, 11:05am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/45 "2018-10-16T11:05:34Z")

</div>

My understanding is that the original proposal (and most of the discussion) was for all blocks.

That said, `module ... end` is regularly broken up to pieces, using `include`. Composite types longer than a screen are, again, code smell, and are fortunately rare.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [October 16, 2018, 11:19am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/46 "2018-10-16T11:19:10Z")

</div>

> [@Tamas\_Papp](#):
>
> My understanding is that the original proposal (and most of the discussion) was for all blocks.

Correct, but I also [mentioned this point all the way up](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/5)

> [@Tamas\_Papp](#):
>
> That said, `module ... end` is regularly broken up to pieces, using `include`

That is not always a solution for some nested modules.

> [@Tamas\_Papp](#):
>
> Composite types longer than a screen are, again, code smell, and are fortunately rare.

This is definitely not true. I agree it shouldn’t happen for all types but anything with more than one or two inner constructor can easily be long and that is not a problem at all.

And again, I don’t think changing (adding to) the keywords is the right solution here, comment is enough, I’m replying again just because people keep saying that long block shouldn’t exist.

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [October 16, 2018, 9:17pm UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/47 "2018-10-16T21:17:37Z")

</div>

> [@DNF](#):
>
> any modern editor you also get indent guides

Is this true with Atom+Juno? I don’t see them but maybe I need an extra package?

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [October 17, 2018, 7:29am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/48 "2018-10-17T07:29:23Z")

</div>

Yes. It’s in Settings \> Editor \> Show Indent Guide.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [October 17, 2018, 8:12am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/49 "2018-10-17T08:12:13Z")

</div>

I’d also recommend the [indent-guide-improved](https://atom.io/packages/indent-guide-improved) package because it clearly indicates at what level of indentation the cursor is at:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/2/12feb0b2e9b7a721e8056b4a4598bdf5e79a9637.jpeg)

IMHO it’s a bit ugly by default but you can add the following to your `styles.less`

```julia
.indent-guide-improved {
  background-color: @syntax-text-color !important;
  opacity: 0.2;
  &.indent-guide-stack {
    opacity: 0.5;
    &.indent-guide-active {
      opacity: 0.9;
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [October 17, 2018, 8:53am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/50 "2018-10-17T08:53:04Z")

</div>

That’s pretty cool. Somewhat amusingly, the indent guide failed to work inside my `styles.less` because you use two spaces as tabs:

 ![06](https://global.discourse-cdn.com/julialang/original/3X/3/f/3f6d43022160ed109a6fcabcc2adec7a3f939922.png)  
😉

Is there a way to automatically fix 2 → 4 tab length? Atom Beautify apparently does not support Julia.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [October 17, 2018, 9:25am UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/51 "2018-10-17T09:25:54Z")

</div>

[indent-dective](https://github.com/JunoLab/atom-indent-detective) works quite well since I fixed it in the last release. 🙂

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [October 17, 2018, 12:47pm UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/52 "2018-10-17T12:47:00Z")

</div>

Maybe I’m missing something, but doesn’t indent-detective just discover what the correct indentation is in a file? Does it also re-indent copy-pasted code to the correct indentation?

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [October 17, 2018, 12:48pm UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/53 "2018-10-17T12:48:35Z")

</div>

Yeah I just noticed I didn’t answer your actual question. You can force the indent to 4 spaces (either by using indent-detctive or some other way) and the use the `Editor: Auto Indent` command. Note that that might mess up any non-standard indents though.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [October 17, 2018, 12:50pm UTC](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605/54 "2018-10-17T12:50:44Z")

</div>

Yess. It works 🙂

[Previous page](https://discourse.julialang.org/t/syntax-suggestion-end-control/8605.md?page=2)
