# Proc params extension

**URL:** <https://www.ruby-forum.com/t/proc-params-extension/157856>\
**Category:** Ruby\
**Created:** [January 16, 2009, 1:28am UTC](https://www.ruby-forum.com/t/proc-params-extension/157856 "2009-01-16T01:28:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjholowaychuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tjholowaychuk](https://www.ruby-forum.com/u/tjholowaychuk)\
**Post date:** [January 16, 2009, 1:28am UTC](https://www.ruby-forum.com/t/proc-params-extension/157856/1 "2009-01-16T01:28:09Z")

</div>

Basically what I need is:

Proc.new { |a,b,c| }.params # =\> [:a, :b, :c]

I was looking into creating a C extension… but yikes the closure  
portion is far beyond my limited C skills (lack of). Any ideas? is this  
even really possible with the way evaluation is performed?

---

<div class="post-metadata">

**Author:** ![tjholowaychuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tjholowaychuk](https://www.ruby-forum.com/u/tjholowaychuk)\
**Post date:** [January 16, 2009, 2:59am UTC](https://www.ruby-forum.com/t/proc-params-extension/157856/2 "2009-01-16T02:59:47Z")

</div>

Hi,

In message “Re: Proc params extension”  
on Fri, 16 Jan 2009 09:27:04 +0900, Tj Holowaychuk  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:  
|  
|Basically what I need is:  
|  
|Proc.new { |a,b,c| }.params # =\> [:a, :b, :c]

1.9 has Proc#parameters:

Proc.new { |a,b,c| }.parameters

# =\> [[:opt, :a, nil], [:opt, :b, nil], [:opt, :c, nil]]

which means all a, b, c are optional, and their default values are  
nil.

```
          matz.

```

---

<div class="post-metadata">

**Author:** ![tjholowaychuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tjholowaychuk](https://www.ruby-forum.com/u/tjholowaychuk)\
**Post date:** [January 16, 2009, 3:10am UTC](https://www.ruby-forum.com/t/proc-params-extension/157856/3 "2009-01-16T03:10:32Z")

</div>

Yukihiro M. wrote:

> Hi,
> 
> In message “Re: Proc params extension”  
> on Fri, 16 Jan 2009 09:27:04 +0900, Tj Holowaychuk  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:  
> |  
> |Basically what I need is:  
> |  
> |Proc.new { |a,b,c| }.params # =\> [:a, :b, :c]
> 
> 1.9 has Proc#parameters:
> 
> Proc.new { |a,b,c| }.parameters
> 
> # =\> [[:opt, :a, nil], [:opt, :b, nil], [:opt, :c, nil]]
> 
> which means all a, b, c are optional, and their default values are  
> nil.
> 
> ```
> matz.
> 
> ```

perfect! that tree would be fantastic, would it be reasonably possible  
to backport as a gem extension? Im not sure what would be involved, or  
if to many changes would have to be made.

Thanks matz

---

<div class="post-metadata">

**Author:** ![tjholowaychuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tjholowaychuk](https://www.ruby-forum.com/u/tjholowaychuk)\
**Post date:** [January 16, 2009, 3:20am UTC](https://www.ruby-forum.com/t/proc-params-extension/157856/4 "2009-01-16T03:20:29Z")

</div>

ps. I know you get this all the time, but thanks for Ruby man! I have  
only been using it for about 2 or 3 months, but I love it, has changed  
my perspective on programming thats for sure. Nice to actually enjoy  
what I do again 🙂

---

<div class="post-metadata">

**Author:** ![tjholowaychuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tjholowaychuk](https://www.ruby-forum.com/u/tjholowaychuk)\
**Post date:** [January 16, 2009, 3:56am UTC](https://www.ruby-forum.com/t/proc-params-extension/157856/5 "2009-01-16T03:56:36Z")

</div>

Hi,

In message “Re: Proc params extension”  
on Fri, 16 Jan 2009 11:09:30 +0900, Tj Holowaychuk  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|perfect! that tree would be fantastic, would it be reasonably possible  
|to backport as a gem extension? Im not sure what would be involved, or  
|if to many changes would have to be made.

It’s possible, but I am not sure if it’s reasonably possible, since  
1.8 and 1.9 are totally different inside.

```
          matz.

```
