#7111: record single inheritance, partial solution to record problem ------------------------------+--------------------------------------------- Reporter: centaurian_slug | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.4.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Testcase: Blockedby: | Blocking: Related: | ------------------------------+---------------------------------------------
Comment(by centaurian_slug): apologies for formatting above data Base = Base { slotA::Int32, slotB::Int32 } data Foo = Foo extends Base { foo :: Int32 } data Bar = Bar extends Base { bar1 :: Float,bar2 ::Float } By analogy to assembly-language:- ; declare 'Base' datsstructure elements RSRESET ;clear structure offset counter slotA RW 1 ; reserve 1 word for 'slotA' slotB RW 1 baseSize RW 0 ; declare 'Foo' datastructure elements RSSET baseSize ; 'Foo' extends 'Base', set counter to end of 'Base' foo RW 1 fooSize RW 0 ; declare 'Bar' datastructure members RSSET baseSize ; 'Bar' extends 'Base' bar1 RW 1 bar2 RW 1 barSize RW 0 ;result:- (4byte words) ;slotA=0, slotB=4, foo=8, bar1=8, bar2=12 ; baseSize=0; fooSize=12; barSize=16 -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7111#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs