From: Michal 'hramrach' Suchanek Date: 2004-10-02T05:23:12+09:00 Subject: Re: Range syntax theory Interesting discussion I will just add my little bit :) On Fri, Oct 01, 2004 at 11:17:11AM +0900, Zach Dennis wrote: > Gavin Sinclair wrote: > > > > > > > > > > >I'll try to come up with a good reasoning. Pretend I'm designing a > >language. > > > >x..y is known to programmers of some other languages as representing a > >"range" (i.e. not necessarily what we'd call a Range, but something close > >to the concept). I decide that this concept will have its own > >representation as a Range object. So: > > > > 2..6 # -> Range object > > > >So far so good. And familiar to some, but by no means all, programmers of > >other languages. It is also used that way in 'normal' or mathematical writing, mostly with two but also with arbitrary number of dots. > > > > > >Now I decide, for the good reasons put forth by others, that end-exlusive > >ranges are useful enough to be treated explicitly as well. I go hunting > >for a way to represent them, and settle on Or we need another range different from the 'normal'. Using just one more dot makes it easy to type, using an operator that has the third character different would be easier to remember. Actually I have to try the ranges in irb when I am not using them for a while to make sure I get the right one. As I am familiar with the <2,6>, <2,6), (or '[' instead of '<') mathematical notation I would use something that resembles that, the round braces are easy to remember in that they 'avoid' the extreme value. but 1[-]6 and 1[-)6 is quite hard to type and the braces would be hard to parse as they are already used differently.. As the mathematical notation is used even in the last years of elementary school around here I would consider it very widespread. But I have no knowledge of the rest of the world. My suggestion would be to use some cleverly English named functions for clarity :) Thanks Michal Suchanek