badkins
2020-7-30 14:44:01

@chansey97 you may find <https://groups.google.com/d/msg/racket-users/4MF2gdq4qWs/1gg1SL-oFAAJ|this thread on units> from the mailing list interesting.


chansey97
2020-7-30 19:58:18

@badkins Thanks for this link. I like Racket’s unit system for two reasons: 1. Unit system can encapsulate mutable state. E.g. for the same unit, we can have multiple instances. 2. Unit system can make programs configurable. E.g. if you have two units with the same signature, we can switch them. Any two of the points above can not be done by Module system, because modules are static and hard-link.


chansey97
2020-7-30 20:01:06

The downside of the unit is that it is a little cumbersome to use… E.g. 1. we must define signature . ~2. we must use define-struct instead of struct in units.~ 3. not support compound names accessor directly, such as XXX.function in ML structure.