[Ironruby-core] is this a bug?

Ivan Porto Carrero ivan at flanders.co.nz
Tue Apr 7 13:03:30 EDT 2009


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 Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090407/c7237eda/attachment.html>


More information about the Ironruby-core mailing list