# Is this a bug?

**URL:** <https://www.ruby-forum.com/t/is-this-a-bug/164950>\
**Category:** IronRuby\
**Created:** [April 7, 2009, 7:15pm UTC](https://www.ruby-forum.com/t/is-this-a-bug/164950 "2009-04-07T19:15:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [April 7, 2009, 7:15pm UTC](https://www.ruby-forum.com/t/is-this-a-bug/164950/1 "2009-04-07T19:15:13Z")

</div>

Hi

Given the following (contrived) code:

namespace PersonLibrary  
{  
public class Person  
{  
public int Id { get; set; }  
public string Name { get; set; }  
}

```
public class Friend
{

    public Friend(Person person)
    {
        Person = person;
    }

    public Person Person { get; private set; }
}

```

}

Wouldn’t you expect the following the code to output JoeSchmoe:

load\_assembly ‘PersonLibrary, Version=1.0.0.0, Culture=neutral,  
PublicKeyToken=null’

class MyFriend \< PersonLibrary::Friend

def initialize(pers)  
super  
@pers = pers  
end

def pers  
@pers  
end  
end

person = PersonLibrary::Person.new  
person.name = “JoeSchmoe”  
person.id = 1

my\_friend = MyFriend.new person  
puts my\_friend.pers.name

But instead it gives me:  
test.rb:0: allocator undefined for MyFriend (TypeError)  
This happens when I call new on the class

Should I file a bug for that?

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [April 7, 2009, 7:30pm UTC](https://www.ruby-forum.com/t/is-this-a-bug/164950/2 "2009-04-07T19:30:28Z")

</div>

Looks like a bug. Please file one against Tomas on Rubyforge.

JD

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Tuesday, April 07, 2009 10:03 AM  
To: ironruby-core  
Subject: [Ironruby-core] is this a bug?

Hi

Given the following (contrived) code:

namespace PersonLibrary  
{  
public class Person  
{  
public int Id { get; set; }  
public string Name { get; set; }  
}

```
public class Friend
{

    public Friend(Person person)
    {
        Person = person;
    }

    public Person Person { get; private set; }
}

```

}

Wouldn’t you expect the following the code to output JoeSchmoe:

load\_assembly ‘PersonLibrary, Version=1.0.0.0, Culture=neutral,  
PublicKeyToken=null’

class MyFriend \< PersonLibrary::Friend

def initialize(pers)  
super  
@pers = pers  
end

def pers  
@pers  
end  
end

person = PersonLibrary::Person.new  
person.name[http://person.name](http://person.name) = “JoeSchmoe”  
person.id[http://person.id](http://person.id) = 1

my\_friend = MyFriend.new person  
puts my\_friend.pers.name[http://my\_friend.pers.name](http://my_friend.pers.name)

But instead it gives me:  
test.rb:0: allocator undefined for MyFriend (TypeError)

This happens when I call new on the class

Should I file a bug for that?

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))
