<div dir="ltr">What about the memory footprint? I recall making measurements using "ghc-datasize" package and the existential appeared to occupy much more space.</div><div class="gmail_extra"><br><br><div class="gmail_quote">
2014-03-10 15:26 GMT+04:00 Simon Peyton Jones <span dir="ltr"><<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Core Libraries committee<br>
<br>
I think Roman is right here. Moreover we have known this for at least I think seven years<br>
<a href="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/20097" target="_blank">http://comments.gmane.org/gmane.comp.lang.haskell.cafe/20097</a>, where I wrote:<br>
<br>
| Yes, Dynamic preceded the Typeable class, I think.<br>
| Were we to do it today, I think we'd have<br>
|<br>
| data Dynamic = forall a . (Typeable a) => Dynamic a<br>
|<br>
| Whether it's worth changing, I'm not sure.  It's a library so,<br>
| if a change desirable, anyone could take a lead.<br>
<br>
The new representation for Dynamic would be good because it's less insecure than all this "Obj" nonsense, instead relying on Typeable, which is pretty good these days.<br>
<br>
Pedro is the most recent visitor to this territory and may have views.<br>
<br>
Roman's point about the method for the Typeable class is a good one too, and not one I've seen discussed.<br>
<br>
Over to you<br>
<br>
Simon<br>
<div><div class="h5"><br>
| -----Original Message-----<br>
| From: Libraries [mailto:<a href="mailto:libraries-bounces@haskell.org">libraries-bounces@haskell.org</a>] On Behalf Of<br>
| Roman Cheplyaka<br>
| Sent: 10 March 2014 10:35<br>
| To: <a href="mailto:libraries@haskell.org">libraries@haskell.org</a><br>
| Subject: Re: Data.Dynamic: Any vs existential<br>
|<br>
| Ok, one reason is that the TypeRep won't be cached in the Dynamic value.<br>
| Even in GHC 7.8 Typeable is defined as<br>
|<br>
|   class Typeable a where<br>
|     typeRep# :: Proxy# a -> TypeRep<br>
|<br>
| instead of<br>
|<br>
|   class Typeable a where<br>
|     typeRep :: Tagged a TypeRep<br>
|<br>
| Why? Is this an oversight?<br>
|<br>
| * Roman Cheplyaka <<a href="mailto:roma@ro-che.info">roma@ro-che.info</a>> [2014-03-10 12:11:27+0200]<br>
| > In Data.Dynamic, Dynamic is defined as<br>
| ><br>
| >   data Dynamic = Dynamic TypeRep Any<br>
| ><br>
| > Does this have any advantage over a safer<br>
| ><br>
| >   data Dynamic = forall a. Typeable a => Dynamic a<br>
| ><br>
| > ?<br>
| ><br>
| > Roman<br>
</div></div>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</blockquote></div><br></div>