kellysmith12.21
2020-9-29 00:37:45

In many languages, submodules are used mostly for organization and namespace management, however Racket’s module system is more advanced than that. Other than the common examples of test and main, what would be some recommended use cases for submodules?


dedbox
2020-9-29 00:54:44

I use submodules to embed implementations in DSLs. For example, I might embed a module containing a GLSL program encoded as s-expressions and then require (or, more likely, local-require) it to get GLSL-formatted source strings. It’s also pretty common to find Typed Racket submodules embedded in untyped Racket for extra performance.


cris2000.espinoza677
2020-9-29 00:55:00

the contract-out form allows to make a submodule that provides the identifiers without contracts. so basically most of the time you’ll see it to limit the amount of provided identifiers, there is also some “hacks” you’ll see around with submodules


laurent.orseau
2020-9-29 05:34:06

I use a drracket submodule to have a drracket-specific behaviour, like plots.


laurent.orseau
2020-9-29 05:36:33

Quickscript uses a submodule so that it’s fast to require only some basic properties of the scripts without requiring the whole code, to build the menus