The use of objects in the BNT

The use of objects in the BNT

The only use of genuine Matlab 5 classes in BNT is the blockmatrix class, since it is convenient to overload the () and = operators. However, implementing classes this way is a pain, since it is impossible to add or display fields without changing the subsasgn/ subsref. Hence for everything else, I simulate objects by using structures, and adding a type tag. In particular, the bnode and potential directories contain dynamic dispatch procedures, which call the appropriate implementation depending on what type of bnode/potential we are dealing with. This is similar to the implementation of objects discussed in Structure and Interpretation of Computer Programs, Abelson and Sussman, MIT Press, 1985. The disadvantage of this technique is the need to extend all the dispatch routines every time we add a new bnode/potential type. However, the overhead of this is negligible compared to the effort involved in implementing the functions themselves.