#789: Make All PMCs Subclassable
-------------------------+--------------------------------------------------
 Reporter:  whiteknight  |       Owner:              
     Type:  todo         |      Status:  new         
 Priority:  normal       |   Milestone:  2.0         
Component:  none         |     Version:  1.3.0       
 Severity:  medium       |    Keywords:  pmc subclass
     Lang:               |       Patch:              
 Platform:               |  
-------------------------+--------------------------------------------------
 Several core PMC types are not subclassable because they have attributes
 that are not the "register" types (P, S, N, I). What happens is that the
 subclass operation acts like normal, but Objects of the resultant class
 are not usable for normal operations.

 Some examples:
  - FileHandle (see #681)
  - ExceptionHandler (See #154)

 Any other PMC type that uses a non-subclassable ATTR will have the same
 problem, although to my knowledge no tickets for these have been opened
 yet.

 I had been working in #681 in a branch, but after talking with Allison we
 decided that the approach had the right idea but the wrong implementation.

 From IRC today (paraphrased):

 {{{
 allison> give PIR Classes the ability to create a delegate or proxy
 structure for ATTRs that aren't register types
 allison> the basic problem is, attributes in PIR Classes are stored in an
 array
 allison> That array can only have PMC elements
 allison> so, it knows how to box and unbox the basic register types
 whiteknight> so do something like box C types into ManagedStruct or
 something similar?
 allison> the best place to start is probably with a list of C types in the
 current C PMCs, and how they can be represented as a PMC
 }}}

 See the whole discussion here:
 [http://irclog.perlgeek.de/parrot/2009-06-24#i_1263385]

 So here's a quick list of tasks that we can do to fix this problem:

  # Get a list together of all ATTRs in built-in PMC types that are not
 INTVAL, FLOATVAL, STRING* or PMC*
  # Determine how to store each of those types in PMCs. This could mean
 using ManagedStruct or UnmanagedStruct, Pointer, CPointer, or some new
 type entirely
  # Teach the GETATTR/SETATTR macros how to access values that are boxed
 like this.

 This whole process probably requires a little bit more thought and
 planning, I'll try to create a page on the wiki somewhere so that we can
 plan this in more detail.

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/789>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to