[Ironruby-core] is this a bug?

Jim Deville jdeville at microsoft.com
Tue Apr 7 13:23:55 EDT 2009


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

JD

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] 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> = "JoeSchmoe"
person.id<http://person.id> = 1

my_friend = MyFriend.new person
puts 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 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/05efdc9b/attachment.html>


More information about the Ironruby-core mailing list