Changes between Version 7 and Version 8 of Annotations


Ignore:
Timestamp:
Oct 14, 2008 7:50:29 AM (6 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Annotations

    v7 v8  
    8181 * Modules must refer to all the packages that contain data structures used in their annotations. This may be a particular problem if you wish to annotate values with things from the GHC package. 
    8282 
    83 A better implementation is described in this section. 
     83A better implementation is described in this section.  The programmer's eye view is largely unchanged: she still declares annotations in the same way. 
     84 
     85From the point of view of a client of the GHC API or a plugin, the interface looks like this: 
     86 
     87{{{ 
     88-- For normal GHC API users: 
     89getAnnotations :: (Typeable a, Binary a) => Name -> GHCM [a] 
     90 
     91-- Only for plugins adding their own annotations: 
     92getAnnotations :: (Typeable a, Binary a) => Name -> CoreM [a] 
     93putAnnotations :: (Typeable a, Binary a) => Name -> a -> CoreM () 
     94}}} 
    8495 
    8596When compiling user-declared annotations (i.e. those in the actual text of the program being compiled): 
     
    187198}}} 
    188199 
    189 This doesn't require any more packages (we could even remove the ByteString usages here) and it does allow use of multiple different serialization libraries for annotations (should that be desirable). However, this doesn't enforce that the serializer and deserializer for a particular bit of data should be coherent and makes the API a bit unfriendlier. 
     200This doesn't require any more packages (we could even remove the ByteString usages here) and it does allow use of multiple different serialization libraries for annotations (should that be desirable). However, this makes the API a bit unfriendlier; and (more important) doesn't enforce that the serializer and deserializer for a particular bit of data should be coherent.  For example, the following could easily happen: 
     201 * A plugin uses binary-2.1 to serialise stuff into Foo.hi 
     202 * A GHC api client uses binary-3.0 to deserialise it 
     203        (probably without realising that they are using the "wrong" Binary) 
     204 
     205Result: extreme broken-ness at run time (not compile time). 
    190206 
    191207== Future Work ==