Why not allow the code-bloat and treat type information as a hint by which compilers/interpreters _may_ optimize? i.e. when an expresion like > foo=goo violates the monomorphism restriction allow overloading (and perhaps code bloat), but if foo is explicitly typed, > foo::Num a=> a->b then treat the assignment like the proposed := operator would (and eliminate the code bloat). A good compiler would flag(warn of) assignments that violate MR and give the programmer the option to optimize them by putting in the appropriate type information whenever they bother to do so. The advantage of this proposal is that it is consistent with rapid prototyping followed by optimizations/refinement. -Alex- ___________________________________________________________________ S. Alexander Jacobson Shop.Com 1-212-697-0184 voice The Easiest Way To Shop On Wed, 24 Feb 1999, Alex Ferguson wrote: > > Thomas Hallgren: > > The monomorphism restriction makes sure that certain values are computed at > most > > once by restricting them to be used at only one type. Couldn't the same be > > achieved by > > > > * getting rid the monomorphism restriction, i.e., let all definitions to be > > overloaded by default, > > * add the language implementation requirement that overloaded values should > be > > computed at most once for each instance they are used at. > > I think this is definitely feasible, but I wonder if it's entirely > prudent. Could definitely lead to a quantity of code-bloat. One > of the annoyances of the MR is that it _disallows_ this as a solution, > even if the compiler were in a position to determine that it was > pragmatically sensible. I can imagine cases where this remedy is > either basically unnecessary (little shared work inside the unapplied > CAF), or worse than the disease (blowup in the number of instances), > so it seems excessive to require it, either. > > Slan libh, > Alex. >
Re: Modifying the monomorphism restriction
S. Alexander Jacobson Wed, 24 Feb 1999 18:01:43 -0500 (Eastern Standard Time)
- Modifying the monomorphism restriction John Hughes
- Re: Modifying the monomorphism restriction S.M.Kahrs
- Re: Modifying the monomorphism restriction Fergus Henderson
- Re: Modifying the monomorphism restriction Christian Sievers
- Re: Modifying the monomorphism restriction Alex Ferguson
- Re: Modifying the monomorphism restriction Joe English
- Re: Modifying the monomorphism restriction Thomas Hallgren
- Re: Modifying the monomorphism restriction Alex Ferguson
- RE: Modifying the monomorphism restriction R.S. Nikhil
- Re: Modifying the monomorphism restriction Alex Ferguson
- Re: Modifying the monomorphism restriction S. Alexander Jacobson
- Re: Modifying the monomorphism restriction Joe English
- Re: Modifying the monomorphism restriction Joe English
- Re: Modifying the monomorphism restriction Alex Ferguson
- Re: Modifying the monomorphism restriction Fergus Henderson