Struct map is a mechanism to let Go code expose simple structs to Elvish code.
The difference between struct maps and maps is convenience for Go code; they
also have different performance characteristics, but since struct maps are
always quite small, the difference is not meaningful for Elvish's use cases.
As a result, there is no good reason that Elvish code needs to be aware of the
difference between struct maps and normal maps. Making them indistinguishable to
Elvish code simplifies the language.
This commit does the following:
- Change Equal, Hash, Kind and Repr to treat struct maps like maps.
- Change Assoc and Dissoc to "promote" struct maps to maps.
- Remove the custom Repr method of parse.Source.
- Update documentation to reflect this change.
* Use a "type" field to identify the type, instead of predicates in the exc:
module.
* Make the reason values behave more like structmaps, including a Repr that
mimics a map.
This fixes#208.
* Fields may now be exposed via getter methods.
* Field names are automatically converted to dashed-case.
* Assoc behavior is no longer implemented for structmaps.
* The IsStructMap marker method no longer takes a special marker argument. There
is a little danger of a value accidentally implementing this method.