MATLAB is not a fully oop yet... why is this?
1 次查看(过去 30 天)
显示 更早的评论
Dear MATLAB community,
Could anyone tell me why some authors say that MATLAB is not a fully object-oriented programming language yet? They never argue.
Thank you!
0 个评论
采纳的回答
Walter Roberson
2012-1-4
MATLAB OOP does not handle multiple inheritance.
Methods are chosen only based upon the first parameter, and not based upon the full signature.
There are some aspects of meta information and dynamic properties that are not really together yet.
Arrays of homogenous objects have to be derived from a specific class, and they have some clunky behaviours.
MATLAB OOP is also measurably slow.
At last glance, it looked like OOP support was not well advanced at all at the Mex level, but I might have misunderstood what I was glancing at.
3 个评论
James Tursa
2012-1-4
FYI, OOP programming at the mex level is very inefficient. The only functions available, mxGetProperty and mxSetProperty, make copies of the properties instead of returning pointers to the properties. For large sized properties this can be a major issue. I have written a mxGetPropertyPtr routine (in the FEX) that solves part of the problem. Your comments remind me that I need to test and post the other routine I wrote, mxSetPropertyPtr, that solves the other half of the problem.
更多回答(1 个)
Titus Edelhofer
2012-1-4
Another aspect: you might well stick to the functional programming paradigm in MATLAB, if you like. My personal view would be to call MATLAB in this sense a hybrid language (in some sense like C++ where you can also mix OOP and functional programming, it's neither nor to 100%).
2 个评论
Sohail S
2012-12-4
Comparing Matlab and C++ is not correct in this sense. C++ is hybrid, but in a different sense, with full ability and efficiency of different paradigms (OOP, generic (template based), structured progrming, system programming, etc). Matlab tries to emulate these practically. However, it doesn't mean either of C++ or matlab is always worse or better (I use matlab)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!