[MacRuby] #613: Dispatch classes should be wrapped in an Data struct to allow subclassing
#613: Dispatch classes should be wrapped in an Data struct to allow subclassing ----------------------------------------+----------------------------------- Reporter: ernest.prabhakar@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- The gcd.c implementation has this cryptic comment: // TODO: These structures need to be wrapped in a Data struct, // otherwise there are crashes when one tries to add an instance // variable to a queue. (Not that that is a good idea.) At first I ignored this, but later it occurred to me that this may be why I am unable to subclass Dispatch::Group (to use for a Future, which contains an instance variable). Is that correct? If so, is there a particular reason why subclassing these would be bad idea? -- Ticket URL: <http://www.macruby.org/trac/ticket/613> MacRuby <http://macruby.org/>
#613: Dispatch classes should be wrapped in an Data struct to allow subclassing ----------------------------------------+----------------------------------- Reporter: ernest.prabhakar@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Changes (by ernest.prabhakar@…): * priority: blocker => minor Comment: FYI, here's the source: http://svn.macosforge.org/repository/ruby/MacRuby/trunk/gcd.c -- Ticket URL: <http://www.macruby.org/trac/ticket/613#comment:1> MacRuby <http://macruby.org/>
#613: Dispatch classes should be wrapped in an Data struct to allow subclassing ----------------------------------------+----------------------------------- Reporter: ernest.prabhakar@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Comment(by pthomson@…): The attached diff covers all the needed changes. I'll commit it as soon as I can be sure that a crash I'm encountering in the RubySpecs is not due to this change. -- Ticket URL: <http://www.macruby.org/trac/ticket/613#comment:2> MacRuby <http://macruby.org/>
#613: Dispatch classes should be wrapped in an Data struct to allow subclassing ----------------------------------------+----------------------------------- Reporter: ernest.prabhakar@… | Owner: pthomson@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Changes (by pthomson@…): * owner: lsansonetti@… => pthomson@… -- Ticket URL: <http://www.macruby.org/trac/ticket/613#comment:3> MacRuby <http://macruby.org/>
#613: Dispatch classes should be wrapped in an Data struct to allow subclassing ----------------------------------------+----------------------------------- Reporter: ernest.prabhakar@… | Owner: pthomson@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Comment(by ernest.prabhakar@…): Wow, very cool. One question: as long as we're making this change, should we also create a Dispatch::Base object containing the common functionality, which all the other objects (well, at least Queue and Source) could inherit from? Oh, and one more: was I correct that this is what prevented me from subclassing Dispatch::Group? -- Ticket URL: <http://www.macruby.org/trac/ticket/613#comment:4> MacRuby <http://macruby.org/>
#613: Dispatch classes should be wrapped in an Data struct to allow subclassing ----------------------------------------+----------------------------------- Reporter: ernest.prabhakar@… | Owner: pthomson@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Comment(by pthomson@…): I had considered making a Dispatch::Base object, but it seemed like overkill. I'm actually not sure that any of the Dispatch objects can be subclassed safely, since they are all of type T_DATA. Calling DATA_PTR() on a subclass of a T_DATA object causes a segmentation fault. I need to look into whether it's possible for subclasses of T_DATA to behave properly when they have to interact with C code. I guess this patch doesn't do much, then. *wry grin* -- Ticket URL: <http://www.macruby.org/trac/ticket/613#comment:5> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby