# Ruby classes in the erlang world

**URL:** <https://www.ruby-forum.com/t/ruby-classes-in-the-erlang-world/108715>\
**Category:** Ruby\
**Created:** [July 6, 2007, 8:05am UTC](https://www.ruby-forum.com/t/ruby-classes-in-the-erlang-world/108715 "2007-07-06T08:05:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Woo-Kyoung\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/c2a13f/32.png) [@Woo-Kyoung\_N](https://www.ruby-forum.com/u/Woo-Kyoung_N)\
**Post date:** [July 6, 2007, 8:05am UTC](https://www.ruby-forum.com/t/ruby-classes-in-the-erlang-world/108715/1 "2007-07-06T08:05:36Z")

</div>

those whom interested in both ruby and erlang,  
I’d like to showing my small work.

I’ve been implemented a bit of ruby classes (String, Array, Range,  
Regexp ,) using by erlang.  
so could do something like

A = ruby:new([1,2,3]),  
Stack = ruby:new([]),  
[1,2,3] = (A(each))(fun(X) → Stack({push,X+1}) end),  
[2,3,4] = Stack(value),

I sent this to the erlang mailing list on a couple of weeks ago,  
and got no replys.  
well, I felt that erlang programmers don’t like this 🙂  
[http://www.erlang.org/pipermail/erlang-questions/2007-June/027592.html](http://www.erlang.org/pipermail/erlang-questions/2007-June/027592.html)

so what I really want to do is that  
you know, erlang’s powerful concurrency.  
check this working between two erlang nodes.

$ erl -sname b  
(b@woo-kyoung-nohs-computer)1\> A=ruby:new([]).  
#Fun\<ruby.1.26108348\>  
(b@woo-kyoung-nohs-computer)2\> A({register, a}).  
true

$ erl -sname c  
(c@woo-kyoung-nohs-computer)1\> N=‘Node’:‘Node’({a,  
‘b@woo-kyoung-nohs-computer’}).  
#Fun\<ruby.1.26108348\>  
(c@woo-kyoung-nohs-computer)2\> N({push,1}).  
[1]

(b@woo-kyoung-nohs-computer)3\> A(value).  
[1]  
(b@woo-kyoung-nohs-computer)4\> A({push,2}).

(c@woo-kyoung-nohs-computer)3\> N(value).  
[1,2]

you could get the code from

svn co [http://wookay.googlecode.com/svn/trunk/erlang/ruby/](http://wookay.googlecode.com/svn/trunk/erlang/ruby/)  
cd ruby  
make test

thank you.  
have a good one.

---

<div class="post-metadata">

**Author:** ![Woo-Kyoung\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/c2a13f/32.png) [@Woo-Kyoung\_N](https://www.ruby-forum.com/u/Woo-Kyoung_N)\
**Post date:** [July 6, 2007, 1:37pm UTC](https://www.ruby-forum.com/t/ruby-classes-in-the-erlang-world/108715/2 "2007-07-06T13:37:23Z")

</div>

On 7/6/07, Woo-Kyoung N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [2,3,4] = Stack(value),  
> check this working between two erlang nodes.  
> #Fun\<ruby.1.26108348\>  
> [1,2]
> 
> thank you.  
> have a good one.

I’m sure Erlang has fascilities for doing what you’re doing without  
faking Ruby. What’s the value in using a crippled library nicked from  
another language? Perhaps the users of the erlang mailing list simply  
didn’t understand. I don’t think I understand either. What do you hope  
to achieve by embedding Ruby standard classes in Erlang?

If you’re trying to implement Ruby on the Erlang platform, I bet a lot  
of people would be interested, but simply being able to fake Array,  
String, Range etc. just isn’t very interesting IMHO.

---

<div class="post-metadata">

**Author:** ![Woo-Kyoung\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/c2a13f/32.png) [@Woo-Kyoung\_N](https://www.ruby-forum.com/u/Woo-Kyoung_N)\
**Post date:** [July 6, 2007, 4:09pm UTC](https://www.ruby-forum.com/t/ruby-classes-in-the-erlang-world/108715/3 "2007-07-06T16:09:43Z")

</div>

My guess you didn’t get a reply is because it’s like reinventing the  
wheel  
and add warts to it.  
Compare with list comprehension  
A = [1,2,3],  
S = [X+1 || X \<- A].

or even  
A = [1,2,3],  
S = lists:map(fun(X) -\> X+1 end, A).
