[darcs-devel] darcs patch: Replace colour by color to uniformise a ... (and 7 more)

David Roundy droundy at darcs.net
Wed Apr 23 13:28:25 UTC 2008


Hi Nicolas,

Thanks for your response.  I'm now applying all these patches--with an
additional one to make the default be to not color hunk contents, since I
find it too much myself.

On Wed, Apr 23, 2008 at 02:08:10PM +0200, Nicolas Pouillard wrote:
> > > hunk ./src/Darcs/ColourPrinter.lhs 211
> > > -make_bold :: Doc -> Doc
> > > -make_bold x = unsafeBoth "\x1B[01m" (packString "\x1B[01m")
> > > -              <> x
> > > -              <> reset_color
> > > +-- memoized version of make_color'
> > > +make_color Blue    = make_color' Blue
> > > +make_color Red     = make_color' Red
> > > +make_color Green   = make_color' Green
> > 
> > I don't see how this achieves any memoization... and perhaps that's the
> > reason why your code seems to be a regression.  Can you explain how this
> > occurs?
> 
> Because  something  like  "make_color' Blue" is a pure constant expression, it
> will be then floated as constant, like in:
> 
> __make_color_Blue = make_color' Blue
> ...
> 
> make_color Blue = __make_color_Blue
> ...
> 
> I'm  pretty  sure  to  haven't lost the optimization, because loosing seems to
> leads to stack-overflows.

This is still a bit mysterious to me, but I'm now satisfied that you've
done your homework.  I still wonder if there's a way this could be done
more clearly, but without too much extra work.  That is to say, in a way
that it's obvious that sharing is going on even in the absence of tricky
optimizations (or at least ones that seem tricky to me).  With just a few
additional lines we could float these constants ourselves.  What do you
think?
-- 
David Roundy
Department of Physics
Oregon State University
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20080423/6b748510/attachment.pgp 


More information about the darcs-devel mailing list