Adam Strzelecki wrote:
> If it possible to call Proc instance with custom bindings.

I don't think so, and in the general case this would be very difficult 
(e.g. it could change dynamically whether 'foo' represents a local 
variable or a method call)

> The reason I am asking, is that I am thinking about improving
> performance of template engines that generate Ruby code upon parsing
> template, and then call eval(@precompiledsrc) upon each render of
> template.

See how Rails solves this problem:

http://github.com/rails/rails/blob/3c1187699a80e0c4a003f5693389595cd644390f/actionpack/lib/action_view/template/renderable.rb

Scroll down to the private 'def compile!' at the bottom.

Regards,

Brian.
-- 
Posted via http://www.ruby-forum.com/.