What is the @named macro needed for?

Why is the @named macro needed here:

@named sys = ODESystem(eqs, t)

I am NOT giving a name to the ODE system… But I get an error if I leave it out.

You can see what a macro does with the @macroexpand macro:

julia> @macroexpand @named sys = ODESystem(eqs, t)
:(sys = ODESystem(eqs, t; name = :sys))

The @named macro just adds a “name” keyword argument to a function call. As for why this is needed, the ODESystem constructor requires it.

1 Like

It will gives the name of the variable (here sys) automatically. All system instances need a name.

CU!

George Datseris (he/him)

1 Like