Units were the wrong approach to everyday modularity.They were, and they are, 
the correct solution to design problems such as those explained in our original 
paper on the idea. 

Units suffer from a large notational overhead for everyday use. The second 
edition, due to Owens and Flatt, does a bit better with the introduction of 
'linking inference’ but it was too little too ate. The other disadvantage of 
units concerns syntactic abstraction. You really want to parameterize modules 
over their implementation language. Shriram generalized units to unit/lang in 
his dissertation, but this proved too difficult to implement. Matthew proposed 
to make modules first-order, as opposed to first-class values, and this worked 
out well. I still use units on rare occasions, for example to mimic complex 
testing contexts and to deploy the same module-level abstraction _twice_ in the 
same program. These situations are rare, however. 

Historical note. ML programmers got it similarly wrong when they pushed for 
“fully functorized” style. Once their compilation manager came online, they 
abandoned this style too and simply allowed the linker to connect structs as 
specified. I happened to be with these MLers for a year, which inspired me for 
the unit-like abstraction when we launched Racket/PLT Scheme. Functors are 
needed in the same situations as units but had less expressive power 
(recursive/dynamic linking). 

— Matthias






> On Jan 21, 2018, at 2:22 PM, Alexis King <lexi.lam...@gmail.com> wrote:
> 
> Hello,
> 
> Racket’s units predate its module system. Indeed, it would seem that
> units were originally intended to *be* Racket’s module system, but
> evidently, that did not work out. My understanding is their replacement
> was due in large part to the desire for a more predictable macro
> compilation model, so Racket’s phased module system is by necessity far
> more statically bound than units were ever designed to be (if anything,
> units seem to have been designed with the express purpose of dynamic
> linking, which is hard to reconcile with compile-time macroexpansion).
> 
> Recently, however, I stumbled upon the paper in which the unit system
> was initially presented, “Units: Cool Modules for HOT Languages” by
> Flatt and Felleisen, and it outlines some interesting, reasonably
> compelling motivations for dynamic linking of first-class modules.
> However (though my memory may be imperfect here), I think I remember
> Matthias mentioning at some point that units were one of the areas where
> Racket “got it wrong”, and evidently whole-program construction via
> units did not pan out. I’m curious about this, since units are still
> distributed with Racket, so they clearly weren’t so wrong that they
> needed to be relegated to the dustbin, and in theory they still have all
> the interesting properties motivated by the original paper. Despite
> that, units seem essentially unused in Racket except in a few small
> places to allow modules with circular dependencies, not really taking
> advantage of any of units’ additional expressive power.
> 
> My question to the list is therefore this: are units truly “dead”, or
> do they have redeeming qualities? Are there some situations where units
> might be preferable to a solution involving, say, first-class functions
> or the object system? If there are useful applications for units, why
> are they essentially unused in modern Racket programming? Are units
> theoretically useful but lacking in some implementation property that
> makes them practically viable? If so, is that practical flaw inherent
> to the concept of dynamically-linked, first-class modules, or is it
> merely a deficiency in Racket’s implementation?
> 
> Apologies for the meandering set of questions, but I am quite curious
> to know more about this particular abstraction from the people who
> experienced it, since its exploration long predates my exposure to
> Racket.
> 
> Alexis
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to