Changes between Version 11 and Version 12 of Annotations

Oct 16, 2008 10:57:00 AM (9 years ago)



  • Annotations

    v11 v12  
    194194==== Alternative 3 ====
     196'''Update: this doesn't actually work because we need to look up the serialization function for user-defined annotations!'''
    196198The other alternative we came up with is to change the GHC API to annotations to this:
    211213Result: extreme broken-ness at run time (not compile time).
     215=== Alternative 4 ====
     217We could use Data to implement serialization, and require that instead of Binary. Advantages are manifold (credit goes to Neil Mitchell for this list):
     219 * You don't get any additional dependencies (other than perhaps SYB,
     220which I hope you are going to add for the GHC API data types anyway).
     222 * You can control the format of the serialisation perfectly, and in a
     223version independent way.
     225 * You can add type structure checksums to stop changed types with the
     226same name being messed around - which should eliminate all heisenbugs
     227from stale .hi files.
     229 * Everyone can write deriving Data/Typeable with automatic deriving.
     231 * Data/Typeable seems a much more natural pair of instances than
     234 * Data has been around and solidified for a lot longer time period, and
     235isn't likely to change in incompatible ways.
     237 * You can serialise things into XML etc. without any interface change,
     238should your requirements change.
     240There are some disadvantages:
     242 * Serialisation will be slower. Not massively slower, but a bit. And
     243hopefully it isn't a bottleneck anyway.
     245 * Datas gunfold won't be defined for abstract data types or those that omit some fields from gfoldl. This actually bites GHC, because the Template Haskell NameFlavour type had an abstract Data instance like that! I've worked around it by making the Data instance expose the internals of NameFlavour
    213247== Future Work ==