Re: pseudo-functors in mlb files
<[email protected]> Mon, 15 Aug 2016 00:03:30 +0000
| Newsgroups | gmane.comp.lang.ml.mlton.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks for this suggestion; it sounds like just what I need! (Incidentally, the command line has to have the variable-value pair as one argument, so it needs to be -mlb-path-var 'var value'; this is a bit counter-intuitive.) Michael On 12/08/2016, 23:32, "Matthew Fluet" <[email protected]> wrote: On Fri, Aug 12, 2016 at 2:40 AM, <[email protected]> wrote: > I have a project where the “naïve” solution is to have two mlb files: > > Variation1.sml > Subsequent1.sml > Subsequent2.sml > > And > > Variation2.sml > Subsequent1.sml > Subsequent2.sml > > The Subsequent files depend on bindings made in Variation1 and 2. Clearly, the “right” way to do this would be to have some sort of massive functor that abstracted the Variation signature and generated the Subsequent files. (Alternatively, one functor per Subsequent file, I suppose.) > > Given the history of my project, there are lots of Subsequent files (not just 2) and I don’t fancy trying to wrap a functor around them all. (Perhaps this is not as bad as I am thinking; feel free to tell me I should just do this.) > > I first thought that I might be able to have a Subsequent.mlb file that was > > Subsequent1.sml > Subsequent2.sml > > And that I could then have variation1.mlb: > > Variation1.sml > Subsequent.mlb > > And variation2.mlb: > > Variation2.sml > Subsequent.mlb > > But this doesn’t work, and for good reason (Subsequent.mlb is elaborated/checked in isolation). > > Is there any good way to get the effect I want? (In particular, having to repeat Subsequent1.sml .. Subsequent2.sml in both files is yucky.) You can (ab)use MLB path variables (http://mlton.org/MLBasisPathMap) to "choose" between variations. That is, you would have: project.mlb: $(VARIATION).sml Subsequent1.sml Subsequent2.sml and then compile with "-mlb-path-var VARIATION Variation1" or "-mlb-path-var VARIATION Variation2". At compile time, the MLB path variables are simply expanded and the resulting MLB is processed, so you get the effect of two different (nearly identical) MLB files from the same source. -- You received this message because you are subscribed to the Google Groups "MLton-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohodev2dev _______________________________________________ MLton-user mailing list [email protected]; [email protected] https://lists.sourceforge.net/lists/listinfo/mlton-user -- You received this message because you are subscribed to the Google Groups "MLton-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohodev2dev _______________________________________________ MLton-user mailing list [email protected]; [email protected] https://lists.sourceforge.net/lists/listinfo/mlton-user