Coding 2023-06-25
I mostly took things easy today. I did just now mess around with writing OCaml modules representing some simple groups. From doing this, I concluded that I need to tweak things some more.
Here's the deal. I wrote a functor that creates a cyclic group given a module containing an int. However. If I want to generate tests for such a module, I need to let the functor that generates the tests know what the order of the group is.
I think there are two ways to accomplish this:
- Create a new signature specifically for cyclic groups that exposes the order.
- Create a functor that generates the relevant cyclic group, next to the module containing the tests.
I think I'm going to need to reach out to someone who knows what they're doing, but my gut reaction is that it's probably more helpful in general to expose the order as part of the interface of the module. My reasoning here is, suppose we have hypothetical other metaprogramming based around these kinds of functors. I think it's a similar amount of effort to implement either option, but it seems more helpful for multiple forms of metaprogramming to all act on the same module, rather than generating their own copies. (My recollection is that each invocation of a functor is a distinct module, even if the input modules are identical.) And this would theoretically allow people to supply their own implementations of, for example, cyclic groups. Not obviously helpful, but I don't see what preventing it would accomplish.
Anyway, it's late, and I should wrap things up.
Good night.