Closed smao-astro closed 3 years ago
The thing is that r
is not necessarily the "function parameter" when you use Set
. Definitions with =
tell Mathematica to evaluate the right side before doing the assignment. Consider the following situation where you evaluated a simple test-code prior to defining your function:
r = 1.2;
phi = 1.5;
r*{Sin[phi], Cos[phi]}
If you now do
AzimuthalVelocityInitial[r_] = r^(-1/2);
you will get the following function definition for AzimuthalVelocityInitial
So Mathematica is using the definition of r
from the outer scope. Only if such a definition does not exist, then r
will evaluate to r
and you will get the same AzimuthalVelocityInitial
you'd get with :=
.
This is why the plugin tells you that it can't find a definition for r
because it really isn't supposed to use r_
here. Therefore, the behavior you're seeing is correct. In general, it is a hard problem for the plugin to determine if a symbol has a definition because to do it right, it would have to evaluate your code which it cannot do.
If you have good reasons for using =
(aka, you know what you're doing), you could use
f[...] := Evaluate[...]
With this, you
f
recognized by the plugin=
Is your feature request related to a problem? Please describe. I am not sure is that I am doing something uncommon or this is an unimplemented feature. Basically rather than defining function using pattern match +
SetDelayed
, sometimes I prefer to useSet
. While the plugin works smoothly for the first case, in the second case when I move my cursor onto parameters inside my function, I get warning belowmini template to reproduce
Describe the solution you'd like If move the cursor to
r
in the function,r
would be recognized as function parameter.Thanks!