# Perspectives for Ruby 2.0

**URL:** <https://rubytalk.org/t/perspectives-for-ruby-2-0/37871>\
**Category:** ruby-talk\
**Created:** [26 May 2007 16:20 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871 "2007-05-26T16:20:02Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![abc](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@abc](https://rubytalk.org/u/abc)\
**Post date:** [26 May 2007 16:20 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/1 "2007-05-26T16:20:02Z")

</div>

Hi,

I'm quite new to Ruby. First of all I must say that Ruby has shocked  
me ever since I discovered it. IMO Ruby has the elegant message  
passing of Smalltalk, some of the dynamism of Dylan and some great  
functional features. Everything with a compact Perl-like synthax,  
clean and readable though.

I would like to pose two questions regarding features I think Ruby  
should include in the future:

1. Are there any plans to introduce function currying? It's a very  
useful feature for function expressions, and it won't be very  
difficult to add. In fact, far I've seen a few implementations of it  
out there. They seem to be more or less ok, but it would be great to  
have it on the standard distribution.

2. What about aspect-oriented programming on Ruby? I know about  
AspectR. However, the project seems to be no more on active  
development. Am I right?

Ruby community has always been very receptive to new ideas. It would  
be great to build a solid AOP extension. This could position Ruby with  
a clear advantage over many languages.

IMO, AspectJ, which is the defacto AOP language is dead end. I worked  
on the AspectJ Compiler project some time ago, and it's a nightmare.  
Things become \*SO\* complex and buggy when trying to deal with  
generics. And I don't want to think about future closures of Java 1.7.  
In contrast, an AOP extension for Ruby could be very several levels of  
magnitude easier.

Thanks,

Arcadio

---

<div class="post-metadata">

**Author:** ![Alexey\_Verkhovsky1](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Alexey\_Verkhovsky1](https://rubytalk.org/u/Alexey_Verkhovsky1)\
**Post date:** [26 May 2007 18:32 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/2 "2007-05-26T18:32:18Z")

</div>

AOP is a creative, massively complex workaround for the constraints of  
static languages.

In Ruby, you can solve all the problems AOP solves, using just Ruby  
interpreter and no external tools and libraries. Moreover, this  
capability so naturally fits with the rest of the language, it doesn't  
even need a name.

Welcome.

> **···**
>
> On 5/26/07, arcadiorubiogarcia@gmail.com \<arcadiorubiogarcia@gmail.com\> wrote:
> 
> > 2. What about aspect-oriented programming on Ruby?
> 
> --  
> Alex Verkhovsky

---

<div class="post-metadata">

**Author:** ![Michael\_Hollins](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Hollins](https://rubytalk.org/u/Michael_Hollins)\
**Post date:** [27 May 2007 10:35 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/3 "2007-05-27T10:35:04Z")

</div>

arcadiorubiogarcia@gmail.com wrote:

> 1. Are there any plans to introduce function currying? It's a very  
> useful feature for function expressions, and it won't be very  
> difficult to add. In fact, far I've seen a few implementations of it  
> out there. They seem to be more or less ok, but it would be great to  
> have it on the standard distribution.

what would you want beyond the following?

[http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby](http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby)

---

<div class="post-metadata">

**Author:** ![abc](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@abc](https://rubytalk.org/u/abc)\
**Post date:** [27 May 2007 14:00 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/4 "2007-05-27T14:00:04Z")

</div>

Well I would want something more implicit, like in Groovy for  
instance:

> **[IBM Developer](https://developer.ibm.com/languages/java/)**
>
> IBM Developer is your one-stop location for getting hands-on training and learning in-demand skills on relevant technologies such as generative AI, data science, AI, and open source.

> **···**
>
> On May 27, 12:31 pm, Michael Hollins \<m...@hollins.id.au\> wrote:
> 
> > arcadiorubiogar...@gmail.com wrote:
> > 
> > \> 1. Are there any plans to introduce function currying? It's a very  
> > \> useful feature for function expressions, and it won't be very  
> > \> difficult to add. In fact, far I've seen a few implementations of it  
> > \> out there. They seem to be more or less ok, but it would be great to  
> > \> have it on the standard distribution.
> > 
> > what would you want beyond the following?
> > 
> > [http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby](http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby)

---

<div class="post-metadata">

**Author:** ![Michael\_Hollins](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Hollins](https://rubytalk.org/u/Michael_Hollins)\
**Post date:** [28 May 2007 14:40 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/5 "2007-05-28T14:40:18Z")

</div>

arcadiorubiogarcia@gmail.com wrote:

> > > 1. Are there any plans to introduce function currying? It's a very  
> > > useful feature for function expressions, and it won't be very  
> > > difficult to add. In fact, far I've seen a few implementations of it  
> > > out there. They seem to be more or less ok, but it would be great to  
> > > have it on the standard distribution.
> > 
> > what would you want beyond the following?
> > 
> > [http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby](http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby)
> 
> Well I would want something more implicit, like in Groovy for  
> instance:  
> [IBM Developer](http://www.ibm.com/developerworks/java/library/j-pg08235/index.html)

So, just so I understand, take the following example:

&nbsp;&nbsp;&nbsp;def multiply(a,b)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a \* b  
&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;triple = lambda { |a| multiply(a,3) }

&nbsp;&nbsp;&nbsp;puts triple.call(10)

I believe you are saying that you'd like the last line to be:

&nbsp;&nbsp;&nbsp;puts triple(10)

Is that right? If so, then I agree that would be nice. I'm guessing that it's difficult to achieve in ruby due to the fact that functions can be called without the parentheses. So, for example if I defined the following uninteresting lambda:

&nbsp;&nbsp;&nbsp;six = lambda { multiply(2,3) }

then the following would be ambiguous:

&nbsp;&nbsp;&nbsp;puts six

Am I trying to invoke the lambda, or am I trying to print the value of the object? To resolve the ambiguity I cannot invoke a lambda with the above syntax. Instead I need to do:

&nbsp;&nbsp;&nbsp;puts six.call()

I'd like to hear from the experts if that is the reason or whether there is something more fundamental. I'm still learning ruby (and liking it BTW), so others will likely have a clearer perspective.

cheers,  
mick

> **···**
>
> > On May 27, 12:31 pm, Michael Hollins \<m...@hollins.id.au\> wrote:
> > 
> > > arcadiorubiogar...@gmail.com wrote:

---

<div class="post-metadata">

**Author:** ![Ken\_Bloom](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@Ken\_Bloom](https://rubytalk.org/u/Ken_Bloom)\
**Post date:** [28 May 2007 15:10 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/6 "2007-05-28T15:10:08Z")

</div>

class Proc  
&nbsp;&nbsp;&nbsp;def curry \*curryargs  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lambda{|\*args| self.call(\*(curryargs+args))}  
&nbsp;&nbsp;&nbsp;end  
end

> **···**
>
> On Sun, 27 May 2007 06:58:55 -0700, arcadiorubiogarcia wrote:
> 
> > On May 27, 12:31 pm, Michael Hollins \<m...@hollins.id.au\> wrote:
> > 
> > > arcadiorubiogar...@gmail.com wrote:
> > > 
> > > \> 1. Are there any plans to introduce function currying? It's a very  
> > > \> useful feature for function expressions, and it won't be very  
> > > \> difficult to add. In fact, far I've seen a few implementations of it  
> > > \> out there. They seem to be more or less ok, but it would be great to  
> > > \> have it on the standard distribution.
> > > 
> > > what would you want beyond the following?
> > > 
> > > [http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby](http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby)
> > 
> > Well I would want something more implicit, like in Groovy for instance:  
> > [IBM Developer](http://www.ibm.com/developerworks/java/library/j-pg08235/index.html)
> 
> --  
> Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.  
> Department of Computer Science. Illinois Institute of Technology.  
> [http://www.iit.edu/~kbloom1/](http://www.iit.edu/~kbloom1/)

---

<div class="post-metadata">

**Author:** ![Greg\_Brown1](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@Greg\_Brown1](https://rubytalk.org/u/Greg_Brown1)\
**Post date:** [28 May 2007 15:26 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/7 "2007-05-28T15:26:35Z")

</div>

We can already do puts triple[10], which gets you close.

> **···**
>
> On 5/28/07, Michael Hollins \<mick@hollins.id.au\> wrote:
> 
> > arcadiorubiogarcia@gmail.com wrote:
> 
> > &nbsp;&nbsp;&nbsp;triple = lambda { |a| multiply(a,3) }
> > 
> > &nbsp;&nbsp;&nbsp;puts triple.call(10)
> > 
> > I believe you are saying that you'd like the last line to be:
> > 
> > &nbsp;&nbsp;&nbsp;puts triple(10)

---

<div class="post-metadata">

**Author:** ![Tomas\_Pospisek](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@Tomas\_Pospisek](https://rubytalk.org/u/Tomas_Pospisek)\
**Post date:** [28 May 2007 15:52 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/8 "2007-05-28T15:52:12Z")

</div>

The ambiguity is there allready

If I write:

&nbsp;&nbsp;&nbsp;&nbsp;puts nuts

Then nuts can either be a variable that will return its value, or it can be a function call that will return the result of calling it. In that sense being able to call (from your example above):

&nbsp;&nbsp;&nbsp;puts six

would be IMHO perfectly sensible, since it would be neither more nor less ambiguous then ruby's default behaveour.  
\*t

> **···**
>
> On Mon, 28 May 2007, Michael Hollins wrote:
> 
> > arcadiorubiogarcia@gmail.com wrote:
> > 
> > > On May 27, 12:31 pm, Michael Hollins \<m...@hollins.id.au\> wrote:
> > > 
> > > > arcadiorubiogar...@gmail.com wrote:
> > > > 
> > > > > 1. Are there any plans to introduce function currying? It's a very  
> > > > > useful feature for function expressions, and it won't be very  
> > > > > difficult to add. In fact, far I've seen a few implementations of it  
> > > > > out there. They seem to be more or less ok, but it would be great to  
> > > > > have it on the standard distribution.
> > > > 
> > > > what would you want beyond the following?
> > > > 
> > > > [http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby](http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby)
> > > 
> > > Well I would want something more implicit, like in Groovy for  
> > > instance:  
> > > [http://www.ibm.com/developerworks/java/library/j-pg08235/index.html](http://www.ibm.com/developerworks/java/library/j-pg08235/index.html)
> > 
> > So, just so I understand, take the following example:
> > 
> > def multiply(a,b)  
> > &nbsp;&nbsp;&nbsp;a \* b  
> > end
> > 
> > triple = lambda { |a| multiply(a,3) }
> > 
> > puts triple.call(10)
> > 
> > I believe you are saying that you'd like the last line to be:
> > 
> > puts triple(10)
> > 
> > Is that right? If so, then I agree that would be nice. I'm guessing that it's difficult to achieve in ruby due to the fact that functions can be called without the parentheses. So, for example if I defined the following uninteresting lambda:
> > 
> > six = lambda { multiply(2,3) }
> > 
> > then the following would be ambiguous:
> > 
> > puts six
> > 
> > Am I trying to invoke the lambda, or am I trying to print the value of the object? To resolve the ambiguity I cannot invoke a lambda with the above syntax. Instead I need to do:
> > 
> > puts six.call()
> > 
> > I'd like to hear from the experts if that is the reason or whether there is something more fundamental. I'm still learning ruby (and liking it BTW), so others will likely have a clearer perspective.
> 
> --  
> -----------------------------------------------------------  
> &nbsp;&nbsp;&nbsp;Tomas Pospisek  
> &nbsp;&nbsp;&nbsp;[http://sourcepole.com](http://sourcepole.com) - Linux & Open Source Solutions  
> -----------------------------------------------------------

---

<div class="post-metadata">

**Author:** ![Ken\_Bloom](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@Ken\_Bloom](https://rubytalk.org/u/Ken_Bloom)\
**Post date:** [28 May 2007 19:40 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/9 "2007-05-28T19:40:14Z")

</div>

The choice of syntax for calling the function also has nothing to do with  
currying.

> **···**
>
> On Tue, 29 May 2007 00:36:27 +1000, Michael Hollins wrote:
> 
> > arcadiorubiogarcia@gmail.com wrote:
> > 
> > > On May 27, 12:31 pm, Michael Hollins \<m...@hollins.id.au\> wrote:
> > > 
> > > > arcadiorubiogar...@gmail.com wrote:
> > > > 
> > > > > 1. Are there any plans to introduce function currying? It's a very  
> > > > > useful feature for function expressions, and it won't be very  
> > > > > difficult to add. In fact, far I've seen a few implementations of it  
> > > > > out there. They seem to be more or less ok, but it would be great to  
> > > > > have it on the standard distribution.
> > > > 
> > > > what would you want beyond the following?
> > > > 
> > > > [http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby](http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby)
> > > 
> > > Well I would want something more implicit, like in Groovy for instance:  
> > > [http://www.ibm.com/developerworks/java/library/j-pg08235/index.html](http://www.ibm.com/developerworks/java/library/j-pg08235/index.html)
> > 
> > So, just so I understand, take the following example:
> > 
> > &nbsp;&nbsp;&nbsp;def multiply(a,b)  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a \* b  
> > &nbsp;&nbsp;&nbsp;end
> > 
> > &nbsp;&nbsp;&nbsp;triple = lambda { |a| multiply(a,3) }
> > 
> > &nbsp;&nbsp;&nbsp;puts triple.call(10)
> > 
> > I believe you are saying that you'd like the last line to be:
> > 
> > &nbsp;&nbsp;&nbsp;puts triple(10)
> > 
> > Is that right? If so, then I agree that would be nice.
> 
> --  
> Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.  
> Department of Computer Science. Illinois Institute of Technology.  
> [http://www.iit.edu/~kbloom1/](http://www.iit.edu/~kbloom1/)

---

<div class="post-metadata">

**Author:** ![Michael\_Hollins](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Hollins](https://rubytalk.org/u/Michael_Hollins)\
**Post date:** [29 May 2007 11:35 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/10 "2007-05-29T11:35:04Z")

</div>

Ken Bloom wrote:

> class Proc  
> &nbsp;&nbsp;&nbsp;def curry \*curryargs  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lambda{|\*args| self.call(\*(curryargs+args))}  
> &nbsp;&nbsp;&nbsp;end  
> end

Please excuse my being slow, but how exactly would I use the above?

---

<div class="post-metadata">

**Author:** ![Chris\_Carter](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@Chris\_Carter](https://rubytalk.org/u/Chris_Carter)\
**Post date:** [28 May 2007 16:44 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/11 "2007-05-28T16:44:52Z")

</div>

Yes, but a method is not an object, whereas a Proc is. So we don't  
know if we want to inspect or call the Proc, it can be reasonably  
assumed you want to call the method because, there is no way to  
inspect the method without trapping it.

> **···**
>
> On 5/28/07, Tomas Pospisek's Mailing Lists \<tpo2@sourcepole.ch\> wrote:
> 
> > On Mon, 28 May 2007, Michael Hollins wrote:
> > 
> > \> arcadiorubiogarcia@gmail.com wrote:  
> > \>\> On May 27, 12:31 pm, Michael Hollins \<m...@hollins.id.au\> wrote:  
> > \>\>\> arcadiorubiogar...@gmail.com wrote:  
> > \>\>\>  
> > \>\>\>\> 1. Are there any plans to introduce function currying? It's a very  
> > \>\>\>\> useful feature for function expressions, and it won't be very  
> > \>\>\>\> difficult to add. In fact, far I've seen a few implementations of it  
> > \>\>\>\> out there. They seem to be more or less ok, but it would be great to  
> > \>\>\>\> have it on the standard distribution.  
> > \>\>\> what would you want beyond the following?  
> > \>\>\>  
> > \>\>\> [http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby](http://moonbase.rydia.net/mental/blog/programming/currying-in-ruby)  
> > \>\>  
> > \>\> Well I would want something more implicit, like in Groovy for  
> > \>\> instance:  
> > \>\> [IBM Developer](http://www.ibm.com/developerworks/java/library/j-pg08235/index.html)  
> > \>\>  
> > \>  
> > \> So, just so I understand, take the following example:  
> > \>  
> > \> def multiply(a,b)  
> > \> a \* b  
> > \> end  
> > \>  
> > \> triple = lambda { |a| multiply(a,3) }  
> > \>  
> > \> puts triple.call(10)  
> > \>  
> > \> I believe you are saying that you'd like the last line to be:  
> > \>  
> > \> puts triple(10)  
> > \>  
> > \> Is that right? If so, then I agree that would be nice. I'm guessing that it's  
> > \> difficult to achieve in ruby due to the fact that functions can be called  
> > \> without the parentheses. So, for example if I defined the following  
> > \> uninteresting lambda:  
> > \>  
> > \> six = lambda { multiply(2,3) }  
> > \>  
> > \> then the following would be ambiguous:  
> > \>  
> > \> puts six  
> > \>  
> > \> Am I trying to invoke the lambda, or am I trying to print the value of the  
> > \> object? To resolve the ambiguity I cannot invoke a lambda with the above  
> > \> syntax. Instead I need to do:  
> > \>  
> > \> puts six.call()  
> > \>  
> > \> I'd like to hear from the experts if that is the reason or whether there is  
> > \> something more fundamental. I'm still learning ruby (and liking it BTW), so  
> > \> others will likely have a clearer perspective.
> > 
> > The ambiguity is there allready
> > 
> > If I write:
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;puts nuts
> > 
> > Then nuts can either be a variable that will return its value, or it can  
> > be a function call that will return the result of calling it. In that  
> > sense being able to call (from your example above):
> > 
> > &nbsp;&nbsp;&nbsp;puts six
> > 
> > would be IMHO perfectly sensible, since it would be neither more nor less  
> > ambiguous then ruby's default behaveour.  
> > \*t
> > 
> > --  
> > -----------------------------------------------------------  
> > &nbsp;&nbsp;&nbsp;Tomas Pospisek  
> > &nbsp;&nbsp;&nbsp;[http://sourcepole.com](http://sourcepole.com) - Linux & Open Source Solutions  
> > -----------------------------------------------------------
> 
> --  
> Chris Carter  
> concentrationstudios.com  
> brynmawrcs.com

---

<div class="post-metadata">

**Author:** ![Chris\_Carter](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@Chris\_Carter](https://rubytalk.org/u/Chris_Carter)\
**Post date:** [29 May 2007 11:45 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/12 "2007-05-29T11:45:43Z")

</div>

add = proc {|x,y| x+y}  
add\_two = add.curry(2)  
add\_two[2] # =\> 4

> **···**
>
> On 5/29/07, Michael Hollins \<mick@hollins.id.au\> wrote:
> 
> > Ken Bloom wrote:  
> > \>  
> > \> class Proc  
> > \> def curry \*curryargs  
> > \> lambda{|\*args| self.call(\*(curryargs+args))}  
> > \> end  
> > \> end  
> > \>
> > 
> > Please excuse my being slow, but how exactly would I use the above?
> 
> --  
> Chris Carter  
> concentrationstudios.com  
> brynmawrcs.com

---

<div class="post-metadata">

**Author:** ![John\_Wilger1](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@John\_Wilger1](https://rubytalk.org/u/John_Wilger1)\
**Post date:** [28 May 2007 16:55 UTC](https://rubytalk.org/t/perspectives-for-ruby-2-0/37871/13 "2007-05-28T16:55:05Z")

</div>

Well...it kind of is... [class Method - RDoc Documentation](http://ruby-doc.org/core/classes/Method.html)

> **···**
>
> On May 28, 9:44 am, "Chris Carter" \<cdcar...@gmail.com\> wrote:
> 
> > Yes, but a method is not an object
> 
> --  
> Regards,
> 
> John Wilger
