
Jake Mcarthur wrote:
On Sep 4, 2008, at 9:52 PM, Tim Chevalier wrote:
I'm no master, but I've never encountered a situation where strictness
annotations would be useful as documentation, nor can I imagine one.
I'm no master either, but how about these simple examples?
data Stream a = Cons !a (Stream a) data Vector3 a = Vector3 !a !a !a
The compiler will certainly be able to infer the strictness itself in most uses, so obviously the purpose for these annotations is not for optimization, but I still would find these annotations useful.
As far as I am aware this statement is false. I do not believe the compiler infers strictness in common uses of either of these cases, and I have seen space blowups / stack blowups because of it. I use the rule of thumb : simple 'scalar' field components should be strict. Scalar is an ill-defined term but typically means non-recursive data types, like Int and Bool. The most natural exception to this rule is the 'memoizing constructor' idiom. Jules