# How did we get here? (Why is Julia such a messy language?)

**URL:** <https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839>\
**Category:** Internals & Design\
**Created:** [August 31, 2024, 11:57am UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839 "2024-08-31T11:57:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarny\_GG\_Channie](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Post date:** [August 31, 2024, 11:57am UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/1 "2024-08-31T11:57:31Z")

</div>

Julia is a great language, but to be honest, I can’t say it’s ideal either. I love the language, but to not be able to criticize it is not a healthy love. It’s like Julia has been optimizing for things people say they care about and measure first, while issues that they didn’t know they cared about get sacrificed in the process.

**Scope independence**

One of my strongest objections is scope dependency. For example, closures actually allow you to write a pseudo-OOP. [The Emergent Features of JuliaLang: Part I · Invenia Blog](https://invenia.github.io/blog/2019/10/30/julialang-features-part-1/#closures-give-us-classic-object-oriented-programming)

Another issue is that if you do some mad stuff, for example, using eval inside macros and so on, the module is not a clean namespace. You cannot safely say that

```julia
module A
  function/macro f()
  ...
  end
end

A.f()/@A.f 

```

is equivalent to declaring function/macro f and then using it in every case. Modules are supposed to be namespaces, but they aren’t clean namespaces.

**GC issues**  
Julia has GC, so it is a memory-safe language, right? Nope. There are a bunch of "unsafe"s that can do something nasty. There is also the issue of compiled code not being GC-ed ever. And yes, the unsafe is indeed used to reinterpret an array in a performant way, which is itself used in order to store type stable “raw bytes”. This is useful, for example, in implementing efficient runtime virtual functions.

**Development shenanigans**  
It is said that in Julia, it is relatively easy to contribute back to the language itself because the language itself is mostly in Julia right? Except… well, developments can and do involve wrangling with unsafe, dealing with undocumented features, etc. There are also many popular packages that use internal, undocumented features.

I thought the Julia compiler was just a thin wrapper that specialized all the functions, did some optimizations, and then passed the function into LLVM, while the lowest calls of the functions are themselves LLVM (for example, x+y eventually is an add instruction or something along the line). Except… shenanigans!

I thought the language was pristine, beautiful, and clean, but the truth is, it’s messy and there are dragons everywhere.

How did we get here?

---

<div class="post-metadata">

**Author:** ![johnmyleswhite](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnmyleswhite/32/31_2.png) [@johnmyleswhite](https://discourse.julialang.org/u/johnmyleswhite)\
**Post date:** [August 31, 2024, 12:05pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/2 "2024-08-31T12:05:56Z")

</div>

This post seems like it’s going to generate a primarily emotional conversation rather than produce actionable insights.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [August 31, 2024, 12:25pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/3 "2024-08-31T12:25:23Z")

</div>

> I thought the language was pristine, beautiful, and clean, but the truth is, it’s messy and there are dragons everywhere.

It turns out almost nothing in this world is “pristine beautiful and clean” while also being useful for complicated tasks (at least if we take those things to mean "so simple that a random person can be expected to understand everything there is to to know about every level of it)

This very much just seems like a mirror of your experience with posting about video games in the transition from

> [@Should we make a push into gaming industry?](https://discourse.julialang.org/t/should-we-make-a-push-into-gaming-industry/98792):
>
> The game industry suffers from the two-culture problem as game designers want high-level languages and game programmers want performant languages. C++ is common for game development today. Is the time ready to create a game development ecosystem in Julia? If it is, what are the strengths and weaknesses of Julia? What niche should we explore first to capitalize on Julia’s strength? Optimistically, can we be greedy with game development too? Can we list what we want in a game/game engine?

to

> [@It ain't easy making a high-performance game. I want to cry](https://discourse.julialang.org/t/it-aint-easy-making-a-high-performance-game-i-want-to-cry/106735):
>
> Well, I dreamed of a game so immersive you could fight like movie characters fight, with lots of units, with complex character building, and so on. One aspect I need is a high-performance simulation of the game world. Making a high-performance game engine IS really difficult. I want to cry. Now, imagine I want to have some units fighting. struct Unit health::Float64 attack::Float64 #Bla bla bla... end function attack!(x::Unit,y::Unit) y.health -= x.attack #Bla bla bla... …

Some things are just complicated. A good language can make it easier to think about and deal with complicated problems, but it won’t _remove_ the complexity.

---

<div class="post-metadata">

**Author:** ![Tarny\_GG\_Channie](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Post date:** [August 31, 2024, 12:45pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/4 "2024-08-31T12:45:13Z")

</div>

> [@johnmyleswhite](#):
>
> This post seems like it’s going to generate a primarily emotional conversation rather than produce actionable insights.

Uhh, I listed 2/3 concrete issues (with their own sub-issues) I have with the language. This is not me speaking up with nothing to back up my claim.

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [August 31, 2024, 12:50pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/5 "2024-08-31T12:50:18Z")

</div>

The point being that these types of threads never actually end up producing anything meaningful/actionable and just devolve. There have been many like it on Discourse in the past and the pattern continues.

I have similar thoughts to Mason though that sometimes complex problems are just complex, there is no magic language that removes all complexity.

---

<div class="post-metadata">

**Author:** ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Post date:** [August 31, 2024, 12:58pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/6 "2024-08-31T12:58:38Z")

</div>

As far as I can tell, Julia’s warts come from 3 major sources:

1. User/library empowerment. Julia tries to make it so that just about anything can be implemented in libraries, and few things have to be added directly to the language. This means giving developers lots of possible tools and access, but also means it’s possible to use them unsafely.
2. Performance. A lot of seemingly elegant solutions to various problems are hard to implement in a performant way, or in a way that works with multiple dispatch. The World Age problem is a major example.
3. Legacy. This affects every programming language over time – you have to support old code, meaning you’re locked into old decisions.

I believe the issues you listed are all a result of 1 + 2. A lot of these issues would be easier to contain if we could get some guarantees on interfaces, but that presents its own challenges – there are several libraries attempting different implementations.

How do other languages handle these problems? Most languages are bigger and have more warts, but one popular language that’s tried to be stay small and performant is Go. Go sacrifices user empowerment, there are plenty of things that libraries just can’t implement (or couldn’t for the longest time), and this makes it much easier to prevent certain problems at the cost of more verbose and less flexible code.

Lisps are more flexible than Julia, but tend to sacrifice a lot of performance, and can lead to much crazier shenanigans.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [August 31, 2024, 12:59pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/7 "2024-08-31T12:59:50Z")

</div>

Maybe just as preemptive reminder, I’ll post this:

> [@Avoiding unnecessary engagement in pointless arguments](https://discourse.julialang.org/t/avoiding-unnecessary-engagement-in-pointless-arguments/99973):
>
> It’s an essentially unavoidable fact that people will come to this forum and make confident statements or demands that reasonable people who are experienced in the language strongly disagree with. These people will sometimes (but not always!) do this in a nasty and unfriendly way. I understand that it is highly tempting to want to give your own personal perspective and weigh in on the issue, and that is valuable, but I would urge people to exercise restraint in doing so when several other peopl…

TLDR: it’s fine to have discussions like this, and it’s fine to disagree with the OP and tell them why you disagree, but lets please try and avoid turning this into a big argument of one person against twenty separate people all at once.

---

<div class="post-metadata">

**Author:** ![Tarny\_GG\_Channie](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Post date:** [August 31, 2024, 1:16pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/8 "2024-08-31T13:16:52Z")

</div>

> [@Satvik](#):
>
> How do other languages handle these problems? Most languages are bigger and have more warts, but one popular language that’s tried to be stay small and performant is Go. Go sacrifices user empowerment, there are plenty of things that libraries just can’t implement (or couldn’t for the longest time), and this makes it much easier to prevent certain problems at the cost of more verbose and less flexible code.
> 
> Lisps are more flexible than Julia, but tend to sacrifice a lot of performance, and can lead to much crazier shenanigans.

In my experience, using Python, at least for the thing it’s good at, doesn’t incur issues with Numpy let alone the language itself. However, when I use Julia, I have a lot of issues with the language itself.

Go was designed for network/web applications. Most don’t require very complicated logic. It can do that because… well… its use case kinda allows it to. That being said, there have been some nasty issues in Go like people adopting crazy workarounds to implement generics like code generation or lisp interpreter.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 31, 2024, 1:25pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/9 "2024-08-31T13:25:25Z")

</div>

> [@Tarny\_GG\_Channie](#):
>
> Uhh, I listed 2/3 concrete issues (with their own sub-issues) I have with the language.

As discussed [Time limits for unfocused discourse threads?](https://discourse.julialang.org/t/time-limits-for-unfocused-discourse-threads/106739), we tend to discourage unfocused threads.

2–3 entirely different questions, but each complex topics in themselves (why does Julia have “unsafe” operations? why should packages be allowed to access undocumented internals? something about functions and macros and `eval`?), is already too much. Coupled with the fact that the overall topic (“Why is Julia such a messy language?”) is unfocused, this clearly falls under that policy so I’m going to put in a time limit.

If you want to open a _specific_ topic with some question about Julia’s design, e.g. “Should Julia eliminate ‘unsafe’ operations?”, you are welcome to. We just don’t want meandering open-ended threads.

---

<div class="post-metadata">

**Author:** ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)\
**Post date:** [August 31, 2024, 2:44pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/10 "2024-08-31T14:44:02Z")

</div>

> [@Tarny\_GG\_Channie](#):
>
> when I use Julia, I have a lot of issues with the language itself.

I like how people pointed out that typically these discussions are not fruitful.

In an attempt to be more helpful, what specific issues blocked you from progressing in your Julia implementations? Maybe we can be helpful if we know exactly what it is that’s blocking you, rather than abstract concepts that we all generally more-or-less agree with?

No tool is perfect, Julia has flaws, we can work together to make it better. You had a reason to complain, and I kind of like that you did instead of staying silent and stop using Julia. I guess we are all trying to help you complain constructively.

---

<div class="post-metadata">

**Author:** ![Tarny\_GG\_Channie](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Post date:** [August 31, 2024, 3:19pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/11 "2024-08-31T15:19:50Z")

</div>

As said in the very first post, these are my issues. Yes, they’ve been issues that have caused me problems before. The scope dependence issue has caused me issues when developing a package because some weird hacks I did stopped working cross the module boundary. The GC issues are things I’ve met myself.

---

<div class="post-metadata">

**Author:** ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)\
**Post date:** [August 31, 2024, 3:22pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/12 "2024-08-31T15:22:09Z")

</div>

No like, do you have a MWE that we can run to reproduce any of your issues? Otherwise we can’t really help you.

---

<div class="post-metadata">

**Author:** ![apieum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/apieum/32/2928_2.png) [@apieum](https://discourse.julialang.org/u/apieum)\
**Post date:** [August 31, 2024, 3:33pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/13 "2024-08-31T15:33:21Z")

</div>

> [@Tarny\_GG\_Channie](#):
>
> Another issue is that if you do some mad stuff, for example, using eval inside macros and so on, the module is not a clean namespace. You cannot safely say that

As some have suggested Julia is complex it may seem messy for you, but decisions are taken considering a lot of use cases you may have not thought.

So to answer you on this issue:

How do you manage `A.f()/@A.f ` when your module A is a bare module ? (without its own include and eval methods)

`eval` (or `macroexpand`) have a parameter to specify the module in which expression is evaluated, when you don’t specify the module, you use `Base.MainInclude.eval` method.  
This is clearly documented at [Core.eval](https://docs.julialang.org/en/v1/base/base/#Core.eval), it prevents calling it in a baremodule inadvertently and allow you to define which eval method is called in your macro/function definition if required.

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [August 31, 2024, 8:37pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/14 "2024-08-31T20:37:42Z")

</div>

> [@Tarny\_GG\_Channie](#):
>
> Another issue is that if you do some mad stuff,

> [@Tarny\_GG\_Channie](#):
>
> There are a bunch of "unsafe"s that can do something nasty.

I’d like to point out that half of each of your first points are essentially caused by giving the user power. The user then needs to use that power wisely but this no language can do for them.

Also note that you can do “mad stuff” in any language. The question should be “do you need to do crazy things to achieve your goals?”. For Julia I would always answer this with “No”. As long as your goals are reasonable, you can write reasonable code to achieve it.

To underline this point with a funny blog post: Most people would think that Haskell is one of the purest languages in existence. But does that mean that you can’t do “mad stuff”? Well I’ll let you decide after reading  
[https://aphyr.com/posts/342-typing-the-technical-interview](https://aphyr.com/posts/342-typing-the-technical-interview)

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [August 31, 2024, 9:18pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/16 "2024-08-31T21:18:53Z")

</div>

You always have the complexity of a Turing complete programming language on top of modern OSs and hardware. The simplicity of a language is in the world of computation that it presents, not the world in which it has to live.

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [August 31, 2024, 10:09pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/17 "2024-08-31T22:09:29Z")

</div>

Every language has the problem that you can call out to the shell and sudo dd to directly plop bits into /dev/mem… doesn’t mean that language is bad. There’s always stupid crap you can do. In Julia I rarely need to do stupid crap. My biggest problem in Julia is that it wall-of-texts error messages with 300 layers of nested parameterized types defined deep inside Turing or SciML or whatever. Makes it hard to know where _i_ went wrong. But I feel like this is getting worked on. Beyond that I have almost no complaints.

---

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [August 31, 2024, 10:13pm UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/18 "2024-08-31T22:13:01Z")

</div>

> [@Tarny\_GG\_Channie](#):
>
> How did we get here?

There are tradeoffs associated with every single decision that gets made. Julia got to where it is by making a long series of decisions over a long period of time, each of which involved a set of tradeoffs. Some people will like the balance of tradeoffs that Julia has achieved, others won’t. It all depends on what you value and what your pet peeves are.

---

<div class="post-metadata">

**Author:** ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)\
**Post date:** [September 1, 2024, 12:39am UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/19 "2024-09-01T00:39:26Z")

</div>

> [@abraemer](#):
>
> I’d like to point out that half of each of your first points are essentially caused by giving the user power. The user then needs to use that power wisely but this no language can do for them.

This is exactly what I was thinking.

OP @Tarny_GG_Channie basically admitted:

> [@Tarny\_GG\_Channie](#):
>
> The scope dependence issue has caused me issues when developing a package because some weird hacks I did stopped working cross the module boundary.

so it should be no surprise that things stopped working, especially if they were using private features that are _by design_ not supported from version-to-version.

This type of issue exists in every large language. No language can perfectly guard the user’s experience unless that language were so extremely limited in features and functionality.

A friend once taught me that many people get far in life by _mainly_ focusing on their strengths rather than being bogged down or overfocusing on their weaknesses. That might be analogical here where OP needs to question why their doing hacky things in Julia, and be open to the community’s help on the “best” alternatives for accomplishing their end goal—use Julia’s strengths, rather than Julia’s weaknesses of internals/private functionalities that aren’t supported from version-to-version.

---

<div class="post-metadata">

**Author:** ![Tarny\_GG\_Channie](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Post date:** [September 1, 2024, 1:47am UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/20 "2024-09-01T01:47:59Z")

</div>

I did the hack to force the code to be run at compile time. I should’ve used CompTime.jl to do the work, but I was unaware of the package at the time, and I heard of nasty world age issues with generated functions, so I went full hacker mode and hacked out a solution. What did I do? It’s a package where, for example, let’s assume the counterfactual that a pokemon can have more than 2 types, and you want to calculate how effective an attack is, you store the elements of the defender as bits, mask the relevant bits, then do a perfect hashing lookup. The perfect hash takes a long time to find, which is why I needed it to be run at compile time.

---

<div class="post-metadata">

**Author:** ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)\
**Post date:** [September 1, 2024, 1:59am UTC](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839/21 "2024-09-01T01:59:07Z")

</div>

Oh I see, that makes sense. And sounds like the type of workaround I also would’ve done. So does CompTime.jl solve your issues? Or are there other things we can help you with?

[Next page](https://discourse.julialang.org/t/how-did-we-get-here-why-is-julia-such-a-messy-language/118839.md?page=2)
