We need to add role annotations for 7.8

Dan Doel dan.doel at gmail.com
Mon Mar 24 15:48:31 UTC 2014


On Mon, Mar 24, 2014 at 10:57 AM, Brandon Allbery <allbery.b at gmail.com>wrote:

> No? Immediately switching to nominal requires those annotations
> immediately. No immediate change is needed if we keep the current default;
> if you have problems with conditional code, you will have them no matter
> what with roles --- the only question is when. Also see SPJ's response.
>

I don't think this is true. If nominal-by-default is not on the road map,
then most people never have to do anything. If I can generalize about
myself at least, most data types that are defined do not have (additional,
role-enforceable) invariants. They are mainly simple combinations of other
types in ways that allow me to structure my code well. So the vast majority
of types defined by people like me should have representational parameters,
unless one of the constituent types is a Set or Map or what have you, in
which case nominal can be inferred, assuming Set and Map are appropriately
annotated. Nominal-by-default would require annotations for every minor
definition like this in order to correctly specify the type.

By contrast, representational-by-default imposes some work/diligence on
authors of data structures with invariants, which tend (in my experience)
to be the minority of definitions, and typically come as libraries.

I feel a little bad suggesting 'unsafety' as the default, but the safe
default imposes a significant, perpetual cost on everyone using the
language in return for defense against occasional oversights by library
authors. That doesn't seem like a good trade off.

--
 Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140324/5ee06db3/attachment.html>


More information about the Libraries mailing list