sschwarzer
2022-7-7 13:51:05

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”).


rntz
2022-7-7 22:15:55

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.


rntz
2022-7-7 22:16:22

currently I’m just using hashes but that gets kinda awkward


samdphillips
2022-7-7 22:17:04

samdphillips
2022-7-7 22:17:55

Oh I missed you looked at units…


rntz
2022-7-7 22:18:29

are there any nice examples of using units?


rntz
2022-7-7 22:19:15

the docs seem extensive and it’s possible they would do what I want but I don’t see a tutorial anywhere


samdphillips
2022-7-7 22:20:10

The Guide link above is the more tutorial style docs.


gmauer
2022-7-7 22:20:55

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


rntz
2022-7-7 22:21:24

hm, I’ll take a look then


rntz
2022-7-7 22:23:49

it does seem like I can’t use units without giving signatures for every name I want to export :confused:


rntz
2022-7-7 22:37:53

also it seems it can’t handle stuff like sharing substructures: http://pasterack.org/pastes/97639 errors


rntz
2022-7-7 22:38:59

yeah, the docs even mention this. but there’s no equivalent of SML “sharing”


rntz
2022-7-7 22:39:36

I can handle that myself just by avoiding inheritance I guess


rntz
2022-7-7 22:52:40

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


rntz
2022-7-7 22:54:15

units feel like someone designed them to write a thesis/paper on them and then nothing’s been done with them since…


mflatt
2022-7-7 23:20:56

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.


rntz
2022-7-8 01:44:30

further playing around has convinced me that I might like using them after all: https://github.com/rntz/ccc/blob/main/units.rkt