From: "trans. (T. Onoma)" Date: 2004-10-12T11:15:46+09:00 Subject: Re: Ruby Directions (was Re: quality of error messages) On Monday 11 October 2004 09:32 pm, David A. Black wrote: | With all the recent talk about ranges (much, but not all, of which | I've read), I've been trying to put my finger on why I find the idea | of a mutable Range sort of paradoxical. I'm far from having any kind | of sound theoretical grounding or rationale... but anyway: | | I think of a range as kind of a fact. For example: (0..10) is "the | fact of being between 0 and 10, inclusive". In which case, changing | *that fact* -- e.g., having "the fact of being between 0 and 10" | *itself* become "the fact of being between 6 and 12" -- makes no | sense. I guess I think of ranges almost more like numbers; it would | make sense to me if (0..10) were literally the same object everywhere | it appeared. | | Anyway, all very speculative, but kind of interesting (to me at least I've been in the trenches with Ranges for the last couple of days. I didn't grasp the above fact on my own, but when you brought it up originally it made instant sense to me. An Interval (what Ruby calls a Range) is defined solely by its sentinels and their exclusivity. So 0..10 is always the same 0..10, just as 10 is always the same 10. It's a Multiton --a Singleton based on multiple parameters. T.