Is this a bug?


#1

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
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)


#2

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

JD

From: 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.namehttp://person.name = “JoeSchmoe”
person.idhttp://person.id = 1

my_friend = MyFriend.new person
puts my_friend.pers.namehttp://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
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)