[go: up one dir, main page]

MIR: add map type and values

Context

Add map type and values. This hits the representation problem for comparable values, as described here.

The particular workaround chosen is the broken Ord implementation: it panics. The problem with this approach is, it's ostensibly impossible to hide this broken Ord implementation from downstream without hiding TypedValue and anything related to it, too (which isn't impossible, but arguably undesirable). Hence, downstream consumers can figuratively shoot themselves in the foot if they're not careful.

This MR doesn't bother with performance considerations, of which there are a couple:

  • is_comparable() requires full type traversal;
  • analogous check in Comparable::try_new requires full value traversal;

Both could be optimized to be O(1), this is left for further work.

Manually testing the MR

cargo test

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR

Merge request reports

Loading