> > def fun(x, y, z)
> >   x = x + y + z
> > end
> >
> > x can't be directly substituted since it's assigned to. It'd have to
> > be translated to 'xx = x + y + z' or something.
> 
> I do not see a problem. The x is local and has no functional baring.
> The translation is simply:
> 
> fun(1,2)  #=>
> 
> def fun(1, 2, z)
> x = 1 + 2 + z
> end

How about this:

def fun(z)
   x = 1
   y = 2

   # unmodified original
   x = x + y + z
end

Then you shouldn't need to worry about rewriting as they would act
more like defult params.

Douglas