Excerpts from Jean-Philippe Bernardy's message of Tue Dec 30 18:30:09 +0100 
2008:
> 
> Storing the text for operators is going to increase memory usage
> somewhat,

Arg :(
  
> it would be nice to
> use some kind of (unsafePerformIO-based) memo table / symbol table to
> share the strings between
> all usages.

Holding all these strings in a persistent state, would hurt memory too.
Imagine opening a file, scrolling all the way down and closing the buffer,
in that case the cache will not be remove and you leak memory.

Sometimes turning a question like
  Is it OK to use unsafePerformIO here?
into
  Why it's not OK to use unsafePerformIO here?
helps me in that kind of situations.

The solutions I see are:

1/ Abstract over a mapping (operator-name |-> UTF-8 version)

   This have several advantages, the first is customization, I guess that
   some people will want to use this feature for only a small set of
   operators. Some others will want to add their own symbols...
   The second reason is that the domain of the mapping have all the strings
   we want to cache.

   The second needed change is to switch from 'Operator String' to
   'Operator (Maybe String)' (or having two constructors), then
   one can store only the useful strings using the mapping.

2/ The second solution is to do the caching/sharing locally to
   an highlighter state, one can even share at the token level,
   generically.

> On Tue, Dec 30, 2008 at 4:16 PM, Nicolas Pouillard
> <[email protected]> wrote:
> >
> > Tue Dec 30 09:43:56 EST 2008  Nicolas Pouillard 
> > <[email protected]>
> >  * Haskell mode: unicodify more operators (based on Gwern Branwen patch).
> >  Ignore-this: 1d759a9a52acbb128d530ed1468e808a
> >
> >    M ./Yi/Lexer/Haskell.x -26 +59
> >    M ./Yi/Lexer/LiterateHaskell.x -13 +21

-- 
Nicolas Pouillard aka Ertai

--~--~---------~--~----~------------~-------~--~----~
Yi development mailing list
[email protected]
http://groups.google.com/group/yi-devel
-~----------~----~----~----~------~----~------~--~---

Reply via email to