# I want it all, and I want it now.... debugging Julia code

**URL:** <https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012>\
**Category:** New to Julia\
**Created:** [October 9, 2025, 2:23pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012 "2025-10-09T14:23:43Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tigerbyte](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Tigerbyte](https://discourse.julialang.org/u/Tigerbyte)\
**Post date:** [October 9, 2025, 2:23pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/1 "2025-10-09T14:23:43Z")

</div>

I decided that I was actually fairly demanding in what I want from a language, and I think most others are also. What _I_ want , anyway, is not only to be informed with a descriptive error message, but to be informed at a certain time, e.g., an early pass, pre-runtime. For example,  
if I type:

> Blockquote

**abstract type abstractparentaltype end**

**julia\> struct mystruct abstractparentaltype \*\*  
\*\* x**  
\*\* end\*\*

**julia\> mystruct(19)**  
**ERROR: MethodError: no method matching mystruct(::Int64)**  
**The type `mystruct` exists, but no method is defined for this combination of argument types when trying to construct it.**

**Closest candidates are:**  
\*\* mystruct(::Any, ::Any)\*\*  
\*\* @ Main REPL[27]:1\*\*

**Stacktrace:**  
\*\* [1] top-level scope\*\*  
\*\* @ REPL[28]:1\*\*

> Blockquote

I get an error message alright, but one that does not help (me) solve what is going on. I would much rather see (before the program is run). a message like:

Did you leave out the ‘\<:’ in the line:

struct mystruct abstractparentaltype

So the block should read:

struct mystruct \<: abstractparentaltype  
x  
end

???

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [October 9, 2025, 2:39pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/2 "2025-10-09T14:39:55Z")

</div>

You can format your code using triple backticks.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [October 9, 2025, 3:02pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/3 "2025-10-09T15:02:34Z")

</div>

Improving error messages is a very long-tail sort of problem, but something we care enough about to have a dedicated label on the issue tracker: [GitHub · Where software is built](https://github.com/JuliaLang/julia/issues?q=state%3Aopen%20label%3A%22error%20messages%22)

Having concrete examples where things can be better is useful — and while improving them can sometimes be tricky, it’s a great way to get involved!

(but yes, please take the time to format your posts; see [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757))

---

<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 9, 2025, 3:19pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/4 "2025-10-09T15:19:16Z")

</div>

> [@Tigerbyte](#):
>
> Did you leave out the ‘\<:’ in the line:

I am not sure how you imagine that Julia could catch that. You _can_ name your fields after abstract types:

```julia
julia> struct D
       AbstractVector
       end

julia> d = D(1)
D(1)

julia> d.AbstractVector
1

```

and

```julia
julia> struct A B
       C
       end

```

is legitimate syntax, eg

```julia
julia> fieldnames(A)
(:B, :C)

```

---

<div class="post-metadata">

**Author:** ![Tigerbyte](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Tigerbyte](https://discourse.julialang.org/u/Tigerbyte)\
**Post date:** [October 9, 2025, 4:00pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/5 "2025-10-09T16:00:21Z")

</div>

yes,  
struct A B  
C  
end is legal,  
but  
struct A B  
C D is illegal  
I think it would involve a combination of knowing the current run time information (error)  
combined with the text of the program then you could deduce the answer.

OR

if you made illegal  
struct A B  
end

forcing  
struct A  
B  
end  
or  
struct A \<:B  
C  
end  
that would work also.

given that struct A \<: B  
C D  
end  
does not work I was surprised that  
struct A B end  
works  
so the rule is  
You can have 0 or 1 names after the name of the struct and then on lines after that you can only have 1 name on a line by itself.  
Not a nice rule.  
should be  
after the name of the struct you can have “\<: abstract name”  
or you can have  
\<\< nothing\>\>

then you can distinguish the two cases.

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [October 9, 2025, 4:32pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/6 "2025-10-09T16:32:58Z")

</div>

It’s weird that `struct A B end` is allowed but not `struct A B C end`. I guess the former is “nice” for 1-field structs (although a semicolon is hardly imposing)… but then why wasn’t this pattern good enough for n-field structs? Maybe it was never a deliberate choice and merely emerged from more generic parser rules.

I expect disallowing `struct A B end` (instead requiring `struct A; B end`) wouldn’t be controversial except that it’d be breaking. Breaking changes have an extremely high barrier to integration, so I expect we’re stuck with this.

All this said, it’s legal syntax (and arbitrarily distant from the `MethodError` thrown) so I think it’d be tough to offer a “helpful” tip in this case.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 9, 2025, 4:35pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/7 "2025-10-09T16:35:55Z")

</div>

Honestly, I don’t even bother trying to read messages from users that don’t bother to format their posts. You have been advised above to format the them with the triple back ticks.

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [October 9, 2025, 4:36pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/8 "2025-10-09T16:36:29Z")

</div>

> [@mikmoore](#):
>
> I expect disallowing `struct A B end` (instead requiring `struct A; B end`) wouldn’t be controversial except that it’d be breaking.

I don’t think clarifying edge cases of ambiguous syntax specifications is “breaking”. It would be breaking only if the documentation explicitly mentioned the old syntax

---

<div class="post-metadata">

**Author:** ![Tigerbyte](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Tigerbyte](https://discourse.julialang.org/u/Tigerbyte)\
**Post date:** [October 9, 2025, 4:42pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/9 "2025-10-09T16:42:42Z")

</div>

💯

just thought of a near-trivial way to solve this and perhaps many other problems. The error message Julia spit out says

> Blockquote

struct son abstractparent  
field1  
end

julia\> son(3)  
ERROR: MethodError: no method matching son(::Int64)  
The type `son` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:  
son(::Any,::Any)  
@ Main REPL[2]:1

> Blockquote

if it added the field names I think it would be near-trivial to debug…  
so the eror message should look like this:

> Blockquote  
> struct son abstractparent  
> field1  
> end

julia\> son(3)  
ERROR: MethodError: no method matching son(::Int64)  
The type `son` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:  
son(abstractparent::Any, field1::Any)  
@ Main REPL[2]:1  
struct son abstractparent  
field1  
end

julia\> son(3)  
ERROR: MethodError: no method matching son(::Int64)  
The type `son` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:  
son(abstractparent::Any, field1::Any)  
@ Main REPL[2]:1  
field1  
end

that would tell you that it is getting confused about what the field names in the type are and that might lead you to the missing \<:

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [October 9, 2025, 4:45pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/10 "2025-10-09T16:45:51Z")

</div>

@Tigerbyte you need to spend time and energy in formatting your posts and making sure they are readable.

You can edit your posts after they’ve been posted. There’s a friendly editor interface to help you along the way if you don’t feel like using markdown; use the bar above the post.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [October 9, 2025, 4:47pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/11 "2025-10-09T16:47:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tigerbyte](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Tigerbyte](https://discourse.julialang.org/u/Tigerbyte)\
**Post date:** [October 9, 2025, 4:59pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/12 "2025-10-09T16:59:07Z")

</div>

when I click on the double quotes it puts the line in my file:  
backquote  
I am using this it just clearly is not having the desired effect. the post looks formatted to me  
line breaks are in the right places, but no colors or bold. so I’m just doin it wrong somehow.  
I do a backquote at the end of the thing I want to highlight or not ? I added one.  
so I have one before and after the error message.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [October 9, 2025, 5:19pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/13 "2025-10-09T17:19:08Z")

</div>

You may find the rich text editor easier to use. Click the far-left button on the toolbar — that M↓ A toggle.

![image](https://global.discourse-cdn.com/julialang/original/3X/a/5/a5c76ca266e672aae58c7338e472c8c040a37292.png)

Either way, the button to format text is `</>`.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [October 9, 2025, 5:28pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/14 "2025-10-09T17:28:04Z")

</div>

Just enclose your code in triple backticks, like ```

Do you have a backtick key on your keyboard?

---

<div class="post-metadata">

**Author:** ![Tigerbyte](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Tigerbyte](https://discourse.julialang.org/u/Tigerbyte)\
**Post date:** [October 9, 2025, 5:41pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/15 "2025-10-09T17:41:11Z")

</div>

here goes

```struct
         field1
         end

julia> son(3)
ERROR: MethodError: no method matching son(::Int64)
The type `son` exists, but no method is defined for this combination of argument types when trying to construct it.

```

---

<div class="post-metadata">

**Author:** ![Tigerbyte](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Tigerbyte](https://discourse.julialang.org/u/Tigerbyte)\
**Post date:** [October 9, 2025, 5:43pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/16 "2025-10-09T17:43:00Z")

</div>

nice

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [October 9, 2025, 9:15pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/17 "2025-10-09T21:15:52Z")

</div>

The syntax ambiguity would be arguable if Julia generally had more rigid rules about newlines, but there isn’t, and we can mostly space out one-liners with unpredictable exceptions e.g. `let` header, `catch` without a variable name, and `struct` fields after the first one. Adding narrower rules _would_ be breaking, so this would have to be left to a v2 that probably won’t come. A v2 could be nice for simplifying the syntax and thus parsing e.g. shortening `function` and not having 3 definition syntaxes with various parsing issues, and `;` isn’t so bad as a substitute for spaces if there is a rule mandating newlines in the v2 documentation.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [October 9, 2025, 9:30pm UTC](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012/18 "2025-10-09T21:30:18Z")

</div>

Have you tried Pluto.jl and the AI assistant it has now? I think that kind of analysis can well be job of an AI assistant.
