Functions vs Methods
BlitzMax Forums/BlitzMax Beginners Area/Functions vs Methods
| ||
Hi, just got BMAX and was using Banks. It seems there are 2 ways to do the same thing value = PeekInt( Bank, index ) value = Bank.PeekInt( index ) I guess I should be doing the Bank.PeekInt method. Thanks Jim |
| ||
Depends if you like a flat (function-based) API or an OOP (method-based) one. I prefer using methods, but many people prefer the functions :-) |
| ||
It's all up to the programmer. I prefer the Object-Oriented style (Methods). |
| ||
Thanks guys, I'll use the Methods. A little faster in this case. Jim |
| ||
I guess you mean faster in the sense of faster to type, since functionally, they're the same. |
| ||
Not sure, I think the functions wrap the methods, so dependent on the compiler, there may be a little extra overhead. |
| ||
Functions are more like the basics of old days inc. Blitz Basic 2. They are easier to understand but it's better to embrace OOP and methods as it yields greater flexibility once you understand it (imho). |
| ||
Not sure, I think the functions wrap the methods, so dependent on the compiler, there may be a little extra overhead. You're right, of course. I thought the discussion was a general discussion of functions versus methods, rather than the BRL standard modules specifically, which implement both. BlitzMax has no ability to inline functions or methods, that I know of, so the BRL standard modules would indeed be faster to call unwrapped. |