DavePearce/Whiley — Issue #55: Retain Nominal Type Information
Author: DavePearce
Created: 2011-10-30 20:33:34+00:00
State: open

Retaining nominal type information in the front end of the compiler would really help the following:

1. **Error Handling.** Essentially, we can then report errors based on type names, rather then type structure. This seems critical to me, since reporting on structure very quickly gets out of hand.
2. **Scope Resolution.** Having spent some time coding with Whiley now, there is some repetitiveness in scoping. Currently, you typically import a module (e.g. import BitBuffer), and then call its members using the module name as a prefix (e.g. BitBuffer.read). Passing around state then leads to things like:

b,reader = BitBuffer.read(reader,3)

which get a bit tedious. Something like:

b = reader.read(3)

would be much nicer of course. If we knew that reader had type BitBuffer.Reader then we might look in BitBuffer automatically.

Retaining nominal type information is not so hard. Essentially, all defined types, return types and parameter types would be in "nominal form". Then, when propagating type information within a method body, we expand types out into "structural form".