"hijackable"/"customizable" keyword for solving the "customized algorithm" issue?

w0rp via Digitalmars-d digitalmars-d at puremagic.com
Wed May 14 15:34:48 PDT 2014


I'm going to get into an opinion on member functions and 
overrides here, and it's kind of "anti-classes," so you can 
choose to ignore this post if you don't want to hear about that.

I think this is a bad idea. One of the things that really appeals 
to me about algorithms presented through functions is that I can 
predict the behaviour of them. It will do something generically 
on a category of types. I think any need to change the behaviour 
of an algorithm either means that the algorithm was written 
incorrectly, or really you just have a different algorithm and 
you should probably use another name for it. One of the things 
I've really lost faith in over the years is method overrides, 
becuase of how confusing it has made code I have had to read. 
These days I prefer generic functions that give me one or maybe a 
couple of places to look when something goes wrong.


More information about the Digitalmars-d mailing list