Programming

Passing a struct as ref through an interface in C#

Didn’t think it’d be any complicated. I’m in the middle of a large refactoring job that is primarily concerned with memory adjacency. When data lies in memory continuously instead of being distributed segments, parallel code scales better because of CPU caching. This is currently my problem with the Parallel implementation of CombInduce, the ‘solver’/program synthesiser that forms the basis of our work in Interpretable AI. This memory adjacency work involves, among other things, to replace…

Continue reading

Programming

Bad examples and inheritance

The other day my students were asking about Covariance/Contravariance, they were visibly frustrated because they were trying to grasp them at once together with covariance/contravariance modifiers on generics. While trying to explain the concept without generics, I came up with an example on the spot about inheritance that didn’t work, so they were even more frustrated. Because the example not only didn’t make a good case for covariance/contravariance, it didn’t work as an example of…

Continue reading