# \#style

**URL:** https://discourse.julialang.org/tag/style/692.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Should global consts that are Refs be UPPER\_SNAKE\_CASE?](https://discourse.julialang.org/t/should-global-consts-that-are-refs-be-upper-snake-case/139024)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 7\
**Last updated:** [August 25, 2026, 12:34pm UTC](https://discourse.julialang.org/t/should-global-consts-that-are-refs-be-upper-snake-case/139024 "2026-08-25T12:34:55Z")

</div>

Should global consts that are Refs be UPPER\_SNAKE\_CASE? What do you think, and why? It seems that there is no consensus among existing code. The ecosystem is split: The docs say “follow Base” The 1.13-dev docs also…

---

## [The current state of function naming style](https://discourse.julialang.org/t/the-current-state-of-function-naming-style/136849)

<div class="topic-metadata">

**Author:** [@lilachint](https://discourse.julialang.org/u/lilachint)\
**Replies:** 24\
**Last updated:** [May 2, 2026, 3:35am UTC](https://discourse.julialang.org/t/the-current-state-of-function-naming-style/136849 "2026-05-02T03:35:02Z")

</div>

I just came across this reply to a new package announcement. In it, they suggested removing underscores from function names to make them more idiomatic for Julia. The question is, is Julia today still strictly abiding …

---

## [Adopt the SciML Style Guide for Julia Base and Standard Library?](https://discourse.julialang.org/t/adopt-the-sciml-style-guide-for-julia-base-and-standard-library/134845)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 10\
**Last updated:** [January 3, 2026, 11:51pm UTC](https://discourse.julialang.org/t/adopt-the-sciml-style-guide-for-julia-base-and-standard-library/134845 "2026-01-03T23:51:09Z")

</div>

After thinking about docstrings from another post, I was wondering if the Julia Style Guide, particularly for Core, Base, and the standard libraries should be further specified, particularly for docstrings. Perhaps a …

---

## [What's your preference for creating literal data-structures?](https://discourse.julialang.org/t/whats-your-preference-for-creating-literal-data-structures/126128)

<div class="topic-metadata">

**Author:** [@jballanc](https://discourse.julialang.org/u/jballanc)\
**Replies:** 9\
**Last updated:** [February 22, 2025, 4:55am UTC](https://discourse.julialang.org/t/whats-your-preference-for-creating-literal-data-structures/126128 "2025-02-22T04:55:20Z")

</div>

Having worked fairly extensively with Clojure, I came to appreciate the approach of building systems focused around data vs code. For example, if you are working on a business rules engine, rather than writing a complex …

---

## [Coding style in unary operator overloading](https://discourse.julialang.org/t/coding-style-in-unary-operator-overloading/123888)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 6\
**Last updated:** [December 17, 2024, 10:42am UTC](https://discourse.julialang.org/t/coding-style-in-unary-operator-overloading/123888 "2024-12-17T10:42:09Z")

</div>

Is there a reason to prefer one of the following two options? Option 1: Base.:-(a::MyType) = MyType(-a.data) Option 2: import Base.- -(a::MyType) = MyType(-a.data)

---

## [Naming variables and constructor functions](https://discourse.julialang.org/t/naming-variables-and-constructor-functions/118222)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [August 15, 2024, 1:32pm UTC](https://discourse.julialang.org/t/naming-variables-and-constructor-functions/118222 "2024-08-15T13:32:06Z")

</div>

This is a style question that has been bugging me for a while so I thought I would ask what others do. Consider a composite type Foo, for which I expose the constructor. This is something that I like to do for non-trivi…

---

## [JuliaFormatter for imports / using](https://discourse.julialang.org/t/juliaformatter-for-imports-using/111704)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 3\
**Last updated:** [March 18, 2024, 4:57pm UTC](https://discourse.julialang.org/t/juliaformatter-for-imports-using/111704 "2024-03-18T16:57:43Z")

</div>

I like writing my imports / using statements in the following style: import CairoMakie import CSV import HDF5 import KernelDensity import Makie import StatsBase using DataFrames: DataFrame using Distributions: Gamma usi…

---

## [Coding style - upper or lower case for enum elements?](https://discourse.julialang.org/t/coding-style-upper-or-lower-case-for-enum-elements/107077)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 0\
**Last updated:** [December 3, 2023, 2:25pm UTC](https://discourse.julialang.org/t/coding-style-upper-or-lower-case-for-enum-elements/107077 "2023-12-03T14:25:43Z")

</div>

The Julia manual for enum has the example @enum Fruit apple=1 orange=2 kiwi=3 According to some style guides for Julia, global constants should be UPPER\_CASE, so should I write @enum Fruit APPLE=1 ORANGE=2 KIWI=3 ins…

---

## [Should Julia have a recognized set of language specific metasyntactic variables?](https://discourse.julialang.org/t/should-julia-have-a-recognized-set-of-language-specific-metasyntactic-variables/106474)

<div class="topic-metadata">

**Author:** [@jmanthony3](https://discourse.julialang.org/u/jmanthony3)\
**Replies:** 11\
**Last updated:** [November 27, 2023, 4:21pm UTC](https://discourse.julialang.org/t/should-julia-have-a-recognized-set-of-language-specific-metasyntactic-variables/106474 "2023-11-27T16:21:10Z")

</div>

Would it be appropriate for the Julia community to have a list of commonly used metasyntactic variables like other languages? For example, Python has spam, ham and eggs. I imagine that such a list could increase the leg…

---

## [Any reason to prefer \`::Type{T}\` over \`T::Type\`?](https://discourse.julialang.org/t/any-reason-to-prefer-type-t-over-t-type/103400)

<div class="topic-metadata">

**Author:** [@mwallerb](https://discourse.julialang.org/u/mwallerb)\
**Replies:** 4\
**Last updated:** [September 1, 2023, 5:56am UTC](https://discourse.julialang.org/t/any-reason-to-prefer-type-t-over-t-type/103400 "2023-09-01T05:56:24Z")

</div>

Suppose you have a function which takes a type as argument, say for example convert function. If you want to constrain this type, idiomatic Julia seems to be the following: convert(::Type{T}, x::Foo) where {T \<: Integer…

---

## [Style: include tests in source files?](https://discourse.julialang.org/t/style-include-tests-in-source-files/103161)

<div class="topic-metadata">

**Author:** [@bcon](https://discourse.julialang.org/u/bcon)\
**Replies:** 5\
**Last updated:** [August 24, 2023, 7:12pm UTC](https://discourse.julialang.org/t/style-include-tests-in-source-files/103161 "2023-08-24T19:12:36Z")

</div>

In a typical Julia package, tests are separated from the source files leading, I’d argue, to the omission of tests and a slower development cycle. I would rather include function tests in the same file and adjacent to t…

---

## [Getter function naming: Consider avoiding nouns](https://discourse.julialang.org/t/getter-function-naming-consider-avoiding-nouns/101832)

<div class="topic-metadata">

**Author:** [@stemann](https://discourse.julialang.org/u/stemann)\
**Replies:** 2\
**Last updated:** [July 20, 2023, 12:53pm UTC](https://discourse.julialang.org/t/getter-function-naming-consider-avoiding-nouns/101832 "2023-07-20T12:53:37Z")

</div>

I am (heavily) considering judging using nouns for (exported) getter accessor functions bad practice. I’ve found myself writing structs with getter accessors named equal to the names of the fields they are getting, i.e.…

---

## [Why does BlueStyle do this?](https://discourse.julialang.org/t/why-does-bluestyle-do-this/91871)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 14\
**Last updated:** [December 20, 2022, 4:31pm UTC](https://discourse.julialang.org/t/why-does-bluestyle-do-this/91871 "2022-12-20T16:31:53Z")

</div>

I recently read through BlueStyle (and YASGuide). There are a few items that feel strange to me. I’ll probably conform and get used to it, but I could use some more convincing on why my way is worse. Why so vertical? …

---

## [How to make a function store data to avoid repeating computation](https://discourse.julialang.org/t/how-to-make-a-function-store-data-to-avoid-repeating-computation/88396)

<div class="topic-metadata">

**Author:** [@natema](https://discourse.julialang.org/u/natema)\
**Replies:** 45\
**Last updated:** [October 17, 2022, 12:22pm UTC](https://discourse.julialang.org/t/how-to-make-a-function-store-data-to-avoid-repeating-computation/88396 "2022-10-17T12:22:49Z")

</div>

I have a function in a module that performs some heavy computation to produce a fixed output. It is hard to predict if the function will be called, and we want to avoid computing it if unnecessary. So, we would like th…

---

## [SciML Style: A Style Guide for Stylish Julia Programmers](https://discourse.julialang.org/t/sciml-style-a-style-guide-for-stylish-julia-programmers/81672)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 14\
**Last updated:** [May 31, 2022, 12:55pm UTC](https://discourse.julialang.org/t/sciml-style-a-style-guide-for-stylish-julia-programmers/81672 "2022-05-31T12:55:05Z")

</div>

Hey everyone, To address some coding uniformity and correctness issues, we have implemented a SciML Style Guide. Details in the Github repo below: The SciML Style emphasizes the points which are essentially required …

---

## [How do I make an histogram with no vertical edges between bars in Plots.jl?](https://discourse.julialang.org/t/how-do-i-make-an-histogram-with-no-vertical-edges-between-bars-in-plots-jl/80671)

<div class="topic-metadata">

**Author:** [@ultrapoci](https://discourse.julialang.org/u/ultrapoci)\
**Replies:** 2\
**Last updated:** [May 7, 2022, 9:12pm UTC](https://discourse.julialang.org/t/how-do-i-make-an-histogram-with-no-vertical-edges-between-bars-in-plots-jl/80671 "2022-05-07T21:12:49Z")

</div>

I would like to make an histogram like this one: but I don’t know how to do it. I can set the fillalpha option to zero to have empty bars, but the vertical edges remain: And if I set linecolor to :transparent, the…

---

## [Is it bad style to write \`a = foo()\` instead of \`a, \_ = foo()\`?](https://discourse.julialang.org/t/is-it-bad-style-to-write-a-foo-instead-of-a-foo/61340)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 4\
**Last updated:** [May 18, 2021, 8:42pm UTC](https://discourse.julialang.org/t/is-it-bad-style-to-write-a-foo-instead-of-a-foo/61340 "2021-05-18T20:42:28Z")

</div>

Suppose I have a function that returns two values, but I am usually only interested in the first one. function foo() nit = 0 res = 1. while res \> 0.1 && nit \< 500 nit += 1 res /= 1 + res…
