Forum: IronRuby is this a bug?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ivan P. (Guest)
on 2009-04-07 21:15
(Received via mailing list)
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)
Jim D. (Guest)
on 2009-04-07 21:30
(Received via mailing list)
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.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 C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
This topic is locked and can not be replied to.