[mlpack-git] [mlpack/mlpack] Remove code redundancy in ns_model_impl.hpp (#674)

Ryan Curtin notifications at github.com
Mon Jun 6 13:12:42 EDT 2016


I agree, those functions are quite ugly, and I thought so when I wrote them too.

For a long time I thought, it is good to avoid inheritance entirely because in some places it can cause a noticeable slowdown (like when a virtual function is used very many times); and even though in many cases inheritance could be a good solution, I thought that if we started allowing inheritance, it would be too easy to miss a case in a PR where someone used inheritance when they shouldn't have.

But I think that there are many places where inheritance can be useful, and I guess, maybe it is necessary to allow it in some situations.  We must be careful though, if we are going to use polymorphism, to avoid going too crazy with it and making everything inherit from other things and making most functions virtual (i.e. we should not make it too much like Java :)).  I think it would be cooler if you could use something like CRTP and do static polymorphism here to accomplish the same goal, but I don't know how possible that is, I haven't thought about it much.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/674#issuecomment-224023859
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160606/376225d0/attachment.html>


More information about the mlpack-git mailing list