My Brain Hurts

Jan 31, 2006 17:58


This has been a very theory-intensive day.  So far I have:
  • Explained the proxy-stub design pattern to Leah.
  • Explained to a user why
    interface I { }
    class K where T : I, P> { }
    class A { }
    class B : I { }
    class M : K { }

    does not compile.  (Clearly B cannot be used as T in K in the last line.  Why? B is an I, but T is constrained to implement I,A>. The fact that an M is an K is irrelevant -- generics are neither covariant nor contravariant in C#! There can be no is-a relationship between I and I when N extends M)
  • Described to a curious coworker the departures of large real-world datasets of decimal integer, decimal float and hex integer most-significant-digit distributions from predicted logarithmic (ie, Benford's Law) distributions.
  • Deduced a correct (I hope) design for the definite assignment algorithm for the null coalescing operator -- which, mysteriously was never specified in the C# 2.0 specification.
  • Wrote three lines of production code implementing said algorithm:
        ScanExpr(expr->exprTest, bsetCur, bsetErr);
        BitSet bsetTemp(bsetCur, &GetHeap());
        ScanExpr(expr->exprElse, bsetTemp, bsetErr);
    Wow, do I feel productive!  Three lines of code in only 7 hours.  Where does the time go?
Previous post Next post
Up