Implementing module, MethodError: objects of type Module are not callable

I’ll go through some of the mistakes:

This isn’t necessary, don’t do it.

Don’t export getindex, it’s not necessary and doesn’t do what you think it does.

The mutable is almost surely not necessary (depending on what you want to do with the type).

The order of colnames and rownames isn’t consistent with the order you assume when you call the constructor. Swap them, for example.

This is the reason for the “objects of type Module are not callable” error. Just do : instead.

Just do x.matrix[i, j], not sure what were you aiming for here.

Lastly, for performance reasons you probably want to keep the type of the variables i and j constant.

3 Likes