Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Roman Maeder's object oriented programming package is nice, but I'm hoping someone can suggest a sleek and novel implementation that is easy to use.

share|improve this question
3  
Can you tell us more about what functionality of OOP you'd most like to implement in Mathematica? –  Jagra Jun 6 '12 at 17:47
2  
Similar: stackoverflow.com/q/7363253/615464 –  Sjoerd C. de Vries Jun 6 '12 at 18:02
1  
OO is a moving target, as is nicely summarized here, so you first need to define which set of features you call OO (as noted already by @Jagra). Implementing some basic OO by itself is not very difficult, but you will face some pretty hard to solve problems, such as performance and garbage collection. In this answer, I dwell a little more on this topic and link to some previous discussions on the matter, which you may find of some interest. –  Leonid Shifrin Jun 6 '12 at 19:38
    
Some interesting discussions in this topic can be found on MathGroup. Here is a recent one. –  Jens Jun 6 '12 at 22:16

1 Answer 1

up vote 4 down vote accepted

Well, one obvious idea would be to build on the struct implementation by Bob Beretta. You would have to add information about methods and modify the implementation of --> to consider those as well, and for polymorphism, you'd also have to store the base class (or base classes, if multiple inheritance should be supported), and have --> look there if the field or method is not found.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.