Afficher un message
Vieux 12/03/2008, 23h00   #5
Florian Gilcher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a method that checks if an object is in a range


On Mar 12, 2008, at 9:20 PM, wojtek@m4chu.net wrote:

> Florian,
>
> Yeah, I know about monkey patching thing, and I wanted to avoid it.


I don't consider this monkey patching. You are extending - there is
nothing
wrong with that. I just wanted to give a reference to the topic where
this
example was used.

Monkey patching would be to change behaviour of methods to fit your
needs
(or to fix bugs that are not yet fixed).

>
> Well, I certainly have chosen somewhat wrong name for the method; all
> I wanted to do is to check whether object is in range. Within or,
> Between are better ones (I knew about that one Daniel, it's just I
> prefer ranges over min/max .
>
> I couldn't agree more with your approach to object/group; but
> conversations like
> "is 13 between 0 and 59"
> "is that date between 1.week.ago and 1.week.from_now"
> sounds reasonable too


That is absolutely true. A comparison is defined in both ways, so
there are many ways to express it. So extending Comparable was the
right way to start.

If you really think you are lacking a way to express yourself,
yourself to it.
Reformulating sentences doesn't , though .

Greetings
Florian Gilcher

  Réponse avec citation
 
Page generated in 0,05975 seconds with 9 queries