Question: are plot variables local automatically?

Basic question on Maple scoping, having hard time finding it doing search.

I noticed when I do this

get_plot:= proc()     
    plot(sin(x),x=-Pi..Pi);
end proc:

Maple did not complain that `x` inside the proc() was implicitly declared. So this tells me that `x` is set local in scope to the body of the plot() itself and this is done automatically. right?  This is same as in Mathematica actually.

But when I did this

get_plot := proc()  
    local x; 
    x:=10;     
    plot(sin(x),x=-Pi..Pi);
end proc:
get_plot();

I got an error that Error, (in plot) unexpected option: 10 = -Pi .. Pi. So my theory was wrong.

While in Mathematica, one can do the above and it will work

getPlot[]:=Module[{x},
  x=10;
  Plot[Sin[x],{x,0,10}]
];
getPlot[]

It works, becuase the x inside plot have local scope for the Plot command only and it is not the same as the x outside the plot.

But in Maple, it seems once I declared x to be local, then the plot will use that local x. 

So the question is, why did Maple not complain in the first example above that x is implicilty declared as normally happen when one does something like

foo := proc()     
    x:=10;     
end proc:

The 'x' is either local or not. which is it? Why above gives warning but not

foo:= proc() 
  plot(sin(x),x=-Pi..Pi); 
end proc:

Basically, I wanted to know if I should write like this

foo:= proc() 
  local x;
  plot(sin(x),x=-Pi..Pi); 
end proc:

or without the local x if not needed.

Please Wait...