This one time, at band camp, O Plameras wrote: >Jamie Wilkinson wrote: >>>>I'm strongly of the opinion that time types are not good types to >>>>overload >>>>like this. >>>> >>>> >>>Value judging is a debate that never ends with no winners and/or losers. >>>I'll not engage >>>you in that. >>> >> >>This isn't a value judgement (unless this is a whimsical pun on the >>overloading of the term 'value', in which case lol). I'm trying very hard >>to give you good evidence why *this particular case* of overloading is not >>a >>good idea. >> > >What I meant by 'value judgment' is one person says it's not good to do >this, like what >you said about 'today + 1' which translates to 'increment by 1 day'. I >could have said >'today + 5' which means 5 days from today.
Uh, you're missing your own point. It doesn't matter how many units you want to increment by, the point is that "today + 1" is completely vague about how many units of time that it's incremented by. Vauge means that humans will either read it and make assumptions, or spend their time looking it up; either way it'll end up being unproductive. Do you want "this_hour + 1" to also increment by a day, or by an hour? >I've seen codes particularly in 'Ruby' that use this specific style of >'overloading'. >So, obviously, the author of that 'Ruby' code made a judgement it's >good idea >to do that. You mentioned Python in your other post, too. Both these languages provide operator overloading. They do it because, as was pointed out way back in the mists of antiquity at the start of this thread, that sometimes it's a good idea. You're trying to prove to us that it's a good idea, and we're agreeing with you in principle, but the specific example you gave is a perfect example of why it's *not* a good idea. So, in the general case, Python and Ruby and all other languages that give you overloading, do so in order to give the programmer the ability to decide -- but that is *not* an endorsement from Guido or DHH or Bjarne, or anyone, that overloading is the right screwdriver for a nail. >There's no principle or 'absolute formula' to make a judgment. That's >why it's >called 'value' judgment because it depends on one's value and values differ. Sure, you're right here. I value my code being readable and maintainable, so I won't use overloading when it adds ambiguity despite it making things shorter to code. That's my judgement, and I stand by it. _______________________________________________ coders mailing list coders@slug.org.au http://lists.slug.org.au/listinfo/coders