# About proc and binding

**URL:** <https://www.ruby-forum.com/t/about-proc-and-binding/188824>\
**Category:** Ruby\
**Created:** [May 19, 2010, 12:56am UTC](https://www.ruby-forum.com/t/about-proc-and-binding/188824 "2010-05-19T00:56:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LAMBEAU\_Bernard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5fc32e/32.png) [@LAMBEAU\_Bernard](https://www.ruby-forum.com/u/LAMBEAU_Bernard)\
**Post date:** [May 19, 2010, 12:56am UTC](https://www.ruby-forum.com/t/about-proc-and-binding/188824/1 "2010-05-19T00:56:14Z")

</div>

Hi,

I’m currently working on a _dsl_ method that allows writing expressions  
given though a proc:

dsl{ x \> y }

I would like to be ensure that x and y are free variables in that proc,  
meaning that:

x = 5  
lambda{ puts x }.call

would result in a NameError: undefined local variable or method `x’.

Is this possible in ruby, i.e. overriding the binding of a proc object,  
in  
any way?

Thanks,  
Bernard
