Re:Java Without If
by pekk on Saturday January 28, 2017 @10:32AM
(#13506707)
What real difference does it make whether repeat is a method on integer objects or whether it takes an integer argument?
[ Parent
| on HN ]
Re:Java Without If
by chriswarbo on Saturday January 28, 2017 @01:09PM
(#13507779)
Because 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.