For the record, there’s https://docs.racket-lang.org/collections/index.html But it doesn’t seem to be in the regular Racket distribution download (if you meant this by “base language”).
if I want something like ML modules or Agda records in Racket — basically, a bunch of definitions in a namespace that can be parameterized — what’s the appropriate feature to use? Ideally I don’t want to have to give a separate signature that lists all of the names I’m defining, but I would like a way of having local/non-exported definitions. Racket modules are nice to use but don’t seem to be parameterizable; namespaces seem like they’re for implementation purposes only; and units seem kinda… cumbersome and weird, you have to invoke them and link them.
currently I’m just using hashes but that gets kinda awkward
Units are like ML modules https://docs.racket-lang.org/guide/units.html#%28tech._unit%29
Oh I missed you looked at units…
are there any nice examples of using units?
the docs seem extensive and it’s possible they would do what I want but I don’t see a tutorial anywhere
The Guide link above is the more tutorial style docs.
Yes but I’ve run into plenty of issues with that to the point that I sometimes would avoid it. A lot had to do with generators/iterators which if I remember correctly it does not support also there was a whole confusing thing where streams and sequences would sometimes be compatible and sometimes not.
Anyways that’s just too flag that yes, sometimes it does strange things
hm, I’ll take a look then
it does seem like I can’t use units without giving signatures for every name I want to export :confused:
also it seems it can’t handle stuff like sharing substructures: http://pasterack.org/pastes/97639 errors
yeah, the docs even mention this. but there’s no equivalent of SML “sharing”
I can handle that myself just by avoiding inheritance I guess
unit-from-context doesn’t even take multiple sig specs, nor is there a way to combine sig specs without defining a whole new signature
units feel like someone designed them to write a thesis/paper on them and then nothing’s been done with them since…
Units were Racket’s original modules. Yes, the unit design was half of my dissertation, but the implementation+use came first. :slightly_smiling_face: But then we switched to the current module system — a shift largely related to macros — and although units received some further attention, we mostly stopped using them for new code. Units are still used in the Racket implementation, especially in DrRacket.
further playing around has convinced me that I might like using them after all: https://github.com/rntz/ccc/blob/main/units.rkt