Changes between Version 11 and Version 12 of Annotations


Ignore:
Timestamp:
Oct 16, 2008 10:57:00 AM (7 years ago)
Author:
batterseapower
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Annotations

    v11 v12  
    194194==== Alternative 3 ====
    195195
     196'''Update: this doesn't actually work because we need to look up the serialization function for user-defined annotations!'''
     197
    196198The other alternative we came up with is to change the GHC API to annotations to this:
    197199
     
    210212
    211213Result: extreme broken-ness at run time (not compile time).
     214
     215=== Alternative 4 ====
     216
     217We could use Data to implement serialization, and require that instead of Binary. Advantages are manifold (credit goes to Neil Mitchell for this list):
     218
     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).
     221
     222 * You can control the format of the serialisation perfectly, and in a
     223version independent way.
     224
     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.
     228
     229 * Everyone can write deriving Data/Typeable with automatic deriving.
     230
     231 * Data/Typeable seems a much more natural pair of instances than
     232Typeable/Binary
     233
     234 * Data has been around and solidified for a lot longer time period, and
     235isn't likely to change in incompatible ways.
     236
     237 * You can serialise things into XML etc. without any interface change,
     238should your requirements change.
     239
     240There are some disadvantages:
     241
     242 * Serialisation will be slower. Not massively slower, but a bit. And
     243hopefully it isn't a bottleneck anyway.
     244
     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
    212246
    213247== Future Work ==