Whoops, I missed your other reply. Never mind this!
Reiner
On 14/05/11 17:46, Reiner Pope wrote:
Ok, understood.
My question is, how do we enforce this? So:
* some fields of Window are nonstrict. Is this just a mistake?
* strictness annotations on (lazy) lists aren't sufficient,
because they only force the head of the list (one example is the
'bufAccessList' field of Window). Currently, strictness of such
lists appears to be enforced with ad hoc folds, all over the
place. Is this indeed the case? Should/could we use a less ad
hoc approach, such as:
o migrating to a custom 'StrictList' type
o using the 'NFData' class from the 'deepseq' package.
Cheers,
Reiner
On 14/05/11 17:27, Jean-Philippe Bernardy wrote:
All the fields in the editor state (and sub-records, eg. buffer state)
should be strict.
Every time the user presses a key, the editor state is updated.
If a field is lazy in a record, setting it creates a thunk that contains the
whole old record. So, there is a risk of accumulating a whole history of
changes (until the field is "forced"). The easy solution to avoid this is
to mark all fields in the editor state as strict. (We do not take advantage
of laziness there anyway).
Hope this helps!
Cheers,
JP.
On Sat, May 14, 2011 at 7:06 AM, Reiner Pope<reiner.p...@gmail.com> wrote:
Hi all,
Is there a policy for strictness of datatypes in Yi, and what is it?
Specifically:
When I write a datatype, which fields should I make strict? For instance,
all fields in Editor are strict, and all fields except 'height' and
'winRegion' in Window are strict. Is there some reasoning underlying this?
What should I do to ensure strictness of lazy datatypes like [a]? For
instance, the 'bufAccessList :: ![BufferRef]' field of 'Window' is marked
strict, but is a list. Is it the client's duty to ensure that this list is
fully evaluated?
Would there be any objections to using the 'deepseq' package to ensure
evaluation? The 'NFData' class is supported by Derive, so it might be
possible to generate many instances automatically.
Cheers,
Reiner
--
Yi development mailing list
yi-devel@googlegroups.com
http://groups.google.com/group/yi-devel
--
Yi development mailing list
yi-devel@googlegroups.com
http://groups.google.com/group/yi-devel