Arc Forumnew | comments | leaders | submitlogin
1 point by rocketnia 4755 days ago | link | parent

I missed this the first time around:

"Message passing should always be O(1) but extend is O(n) where n is the number of times the function has been extended."

As I said, the number of extensions of a function is almost always a constant in any given program (and a small one at that). I do believe your constant factor would be smaller than mine, but we can't decide that without runnable code. ^_^



1 point by Pauan 4755 days ago | link

Right, which means you shouldn't be choosing one or the other based solely on efficiency. I mention it for completeness, since we're dissecting the pros and cons of the two approaches. And who knows, somebody might actually find the O(1) approach better for their needs.

However... if message passing can do everything just as good as extend (at least pertaining to data types), then that small efficiency advantage could be enough to tip things over.

-----