Sketch of design requirements for a Provider use case #37
Replies: 1 comment
|
Hi @jonahbeckford sorry it took me a while to get back to you! I know we chatted also in PRs and stuff. I wanted to give you some heads up, as I have edited the project README with a cautionary note where I express some doubts I have about this project future. I initially used it (vcs) and now use OCaml Objects, and have been pretty happy with that. So, I don't know where you are in your project, but perhaps |
Uh oh!
There was an error while loading. Please reload this page.
Transferred from #14
Context: I'm considering using Provider in DkCoder. The main simplifier is that I have structural information from codept about all the modules, module types and functors in a project. Another simplifier is that I can and do inject modules aliases on the top of each
.mlscript (like a PPX but with awareness of the whole project).One of the last features to implement is conditional modules. For example, having
MyGame_DirectXBackend.mlcompile only on Windows andMyGame_MetalBackend.mlcompile on macOS. And when it does compile, I'd want to pass theMyGame_DirectXBackendmodule a Windows DirectX implementation module andMyGame_MetalBackend.mlan Apple Metal framework module. Basically, do the wiring on behalf of the developer (similar to Spring wiring in Java programs).I have an initial design based on matching functor parameter types (ex.
module Make (Mtl: REQUIRES_APPLE_METAL) = struct let device = Mtl.createSystemDefaultDevice() end) with one or more corresponding module implementations (ex.module Provides_APPLE_METAL () = struct ... end).When I get to finalizing the design next year, I might switch to use your Provider implementation. But one big difference is I can only take advantage of module/module type information (ex. the
ProviderandReadermodules were accessed in moduleabc.ml) rather than value/type information (ex.[> reader ] Provider.packageis an argument to a function). I think I'd have to provide a high-level wrapper aroundProvider.lookupto perform lookups on a global Provider (or a Provider that I inject into each.mlscript).Anyway, that is my thoughts for now. I probably will ask more questions next year. But I'm open to suggestions before that.
All reactions