Entomy / Ada-Improvements

Repository of Ada language improvement ideas
GNU General Public License v3.0
4 stars 0 forks source link

Named/Anonymous parity #15

Open Entomy opened 5 years ago

Entomy commented 5 years ago

Ada does:

For reasons not well understood, and probably related to changing design ideals while maintaining backwards compatibility, names and anonymous types do not share the same support or usability. This is especially the case with access types, with wildly different rules for each.

It should be:

Named types should just be an alias of the anonymous type, allowing for greatly simplified rules, which helps both the programmer and the implementer.

Name aliases should still be provided because they are useful for nominative typing enforcement, a well as being something to allow contracts defined for.

Rationale:

3.10.2 is notoriously complex, and is also only part of the problem. Instead of compounding complexity with different rules for named and anonymous, just pick the rules for one, and have the two forms be fundamentally equivalent.