Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    It wouldn't be more complicated in C#: Type type = this.GetType(); if (type != typeof(Empty<T>) && type != typeof(ConsCell<T>)) throw new Exception(); Commented Aug 7, 2012 at 17:07
  • @svick, well observed. I wasn't taking into account that the base type would be parameterised. Commented Aug 7, 2012 at 19:22
  • Brilliant! I guess this is good enough for doing "manual static type checking". I'm more looking to eliminate honest programming errors rather than malicious intent. Commented Aug 8, 2012 at 16:13