3 ms·
What real difference does it make whether repeat is a method on integer objects or whether it takes an integer argument?
by pekk 10y ago
What real difference does it make whether repeat is a method on integer objects or whether it takes an integer argument?
- chriswarbo 10y agoBecause a method on an integer object would mean it works in the same way as all library and application code; and therefore can be used as-is, or avoided by those who don't want it, or replaced if something better comes along. Having "for" not be a method on an object means it's something completely different: a magical keyword control structure, a gift from the irreproachable language designers to the lowly language users; since mere users cannot be trusted to make such decisions for themselves.