#778: Make FileHandle Subclassable
-------------------------+--------------------------------------------------
 Reporter:  whiteknight  |       Owner:           
     Type:  RFC          |      Status:  new      
 Priority:  normal       |   Milestone:           
Component:  none         |     Version:  1.3.0    
 Severity:  medium       |    Keywords:  io oo pmc
     Lang:               |       Patch:           
 Platform:               |  
-------------------------+--------------------------------------------------
 There were some other related tickets (I can't find them now) about this,
 so sorry if I am duplicating anything.

 FileHandles are not current subclassable in PIR because they have ATTRs
 that are not usable from PIR (char*, PIOOFF_T, etc). In order for a PMC
 like FileHandle to be properly subclassable, every one of it's ATTRs must
 be an INTVAL, FLOATVAL, STRING* or PMC*. Otherwise, the subclass will
 throw an exception if we try to access an ATTR that is not one of these
 from the parent type.

 I want to make two changes to FileHandle (in addition to the cleanups I am
 working on in the io_cleanups branch right now) to make this possible:

 1) Create a new IOBuffer PMC type to take care of buffering. FileHandle
 will then delegate it's buffering needs to a PMC of this type. The benefit
 here is that we can use this same buffering functionality from other IO
 PMC types (sockets, pipes, etc).
 2) Convert the ATTRs file_pos and last_pos from type PIOOFF_T into type
 INTVAL. This may be a lossy transition but it's worth noting that almost
 every use of these two ATTRs, outside the IO API, are converted to INTVAL
 already.

 #2 of course is a little sketchy, so I would be happy to hear about
 alternate ideas to fix this issue. Shortly after getting these ATTRs fixed
 (if not immediately thereafter) we should be able to properly subclass
 FileHandles.

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/778>
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