www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D3 suggestion: rename "range" to "sequence"

reply "Tommi" <tommitissari hotmail.com> writes:
Renaming the concept of "range" to "sequence" would make our 
terminology more consistent with mathematics. It requires typing 
three more characters, but I think the gained consistency makes 
it worth it.

http://en.wikipedia.org/wiki/Sequence

I know, not a current issue, but better bring it up now than when 
it's too late.
Oct 03 2012
next sibling parent reply =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <alex lycus.org> writes:
On 04-10-2012 05:04, Tommi wrote:
 Renaming the concept of "range" to "sequence" would make our terminology
 more consistent with mathematics. It requires typing three more
 characters, but I think the gained consistency makes it worth it.

 http://en.wikipedia.org/wiki/Sequence

 I know, not a current issue, but better bring it up now than when it's
 too late.

Look, not to sound dismissive, but D3 is not a thing and likely will never be. -- Alex Rønne Petersen alex lycus.org http://lycus.org
Oct 03 2012
parent Walter Bright <newshound1 digitalmars.com> writes:
On 10/3/2012 9:18 PM, Tommi wrote:
 Some (not me) might argue that programming is a branch of mathematics.
 That aside, consistency makes it so that someone, who knows the term
 from previous math studies and starts learning programming, is going to
 have a pretty good idea what the term means even before it's been
 explained to him.

Sure, but if there's not an exact 1:1 correspondence, naming them the same as mathematical terms can bring along counterintuitive baggage. There's plenty of that already with floating point 'math' !
Oct 03 2012
prev sibling next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 10/3/12 11:04 PM, Tommi wrote:
 Renaming the concept of "range" to "sequence" would make our terminology
 more consistent with mathematics.

Ranges are not sequences because e.g. some allow random access. Andrei
Oct 03 2012
parent reply Walter Bright <newshound1 digitalmars.com> writes:
On 10/3/2012 9:07 PM, Tommi wrote:
 So, sequence it's like set, except order matters.
 http://en.wikipedia.org/wiki/Set_%28mathematics%29

I wish to point out that order doesn't necessarily matter with a range, so there is not a 1:1 correspondence with a sequence. For example, the ordering of elements in an associative array is arbitrary.
Oct 03 2012
parent Jacob Carlborg <doob me.com> writes:
On 2012-10-04 07:12, Walter Bright wrote:

 I wish to point out that order doesn't necessarily matter with a range,
 so there is not a 1:1 correspondence with a sequence.

 For example, the ordering of elements in an associative array is arbitrary.

Only if it's uses a hash implementation, which it does in D, I assume. -- /Jacob Carlborg
Oct 03 2012
prev sibling next sibling parent "Bernard Helyer" <b.helyer gmail.com> writes:
On Thursday, 4 October 2012 at 03:10:56 UTC, Alex Rønne Petersen 
wrote:
 Look, not to sound dismissive, but D3 is not a thing and likely 
 will never be.

Well _I'll_ be dismissive. This idea, even if we were doing the D3 thing, is completely pointless. D != maths. I don't know why I have to point that out, but here we are! :P
Oct 03 2012
prev sibling next sibling parent "Tommi" <tommitissari hotmail.com> writes:
On Thursday, 4 October 2012 at 03:12:21 UTC, Andrei Alexandrescu 
wrote:
 Ranges are not sequences because e.g. some allow random access.

Here are a couple of definitions for a sequence: 1) A sequence is an ordered list of objects (or events). 2) A sequence is a discrete function. http://en.wikipedia.org/wiki/Sequence 3) A function with domain a set of successive integers http://wiki.answers.com/Q/What_is_the_definition_fro_sequence_in_math 4) A list of numbers or objects in a special order http://www.mathsisfun.com/definitions/sequence.html The definition doesn't seem to consider how the function that defines the sequence is defined, sequentially or algebraically. And often times it's possible to figure out the algebraic correspond to a sequentially defined function. So, sequence it's like set, except order matters. http://en.wikipedia.org/wiki/Set_%28mathematics%29
Oct 03 2012
prev sibling next sibling parent "Tommi" <tommitissari hotmail.com> writes:
On Thursday, 4 October 2012 at 03:39:20 UTC, Bernard Helyer wrote:
 Well _I'll_ be dismissive. This idea, even if we were doing
 the D3 thing, is completely pointless. D != maths. I don't
 know why I have to point that out, but here we are! :P

Some (not me) might argue that programming is a branch of mathematics. That aside, consistency makes it so that someone, who knows the term from previous math studies and starts learning programming, is going to have a pretty good idea what the term means even before it's been explained to him.
Oct 03 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Thursday, October 04, 2012 06:18:51 Tommi wrote:
 On Thursday, 4 October 2012 at 03:39:20 UTC, Bernard Helyer wrote:
 Well _I'll_ be dismissive. This idea, even if we were doing
 the D3 thing, is completely pointless. D != maths. I don't
 know why I have to point that out, but here we are! :P

Some (not me) might argue that programming is a branch of mathematics. That aside, consistency makes it so that someone, who knows the term from previous math studies and starts learning programming, is going to have a pretty good idea what the term means even before it's been explained to him.

No matter how close the an idea in mathematics may be to D's ranges, it won't be enough to know how to use them. At minimum, you'd need additional documentation to understand how to use them. And the term range is quite accurate for what we're using it for anyway. Changing the name would just generate more confusion, and if we were to change it for a hypothetical D3, it would be even worse than changing it now, because by then, way more people would be familiar with the term range. You wouldn't start using a new term for iterators just because you managed to find a term which was ostentsibly better would you? That would just confuse people to no end. And even if it's not that way with ranges quite yet, it'll be close enough by the time we even consider creating a new version of the language. - Jonathan M Davis
Oct 03 2012
prev sibling next sibling parent "Tommi" <tommitissari hotmail.com> writes:
On Thursday, 4 October 2012 at 04:30:56 UTC, Jonathan M Davis 
wrote:
 Changing the name would just generate more confusion, and if we 
 were to change
 it for a hypothetical D3, it would be even worse than changing 
 it now, because
 by then, way more people would be familiar with the term range. 
 You wouldn't
 start using a new term for iterators just because you managed 
 to find a term
 which was ostentsibly better would you? That would just confuse 
 people to no
 end. And even if it's not that way with ranges quite yet, it'll 
 be close
 enough by the time we even consider creating a new version of 
 the language.

That's a good point. I guess that train has passed then.
Oct 03 2012
prev sibling next sibling parent "Adam Wilson" <flyboynw gmail.com> writes:
On Wed, 03 Oct 2012 20:04:06 -0700, Tommi <tommitissari hotmail.com> wrote:

 Renaming the concept of "range" to "sequence" would make our terminology  
 more consistent with mathematics. It requires typing three more  
 characters, but I think the gained consistency makes it worth it.

 http://en.wikipedia.org/wiki/Sequence

 I know, not a current issue, but better bring it up now than when it's  
 too late.

I'm not sure I see the value. The computer programming world has settled on Range (D isn't the only language to use them). And frankly consistency with the programming world is much more important than consistency with mathematics which only has a secondary interest in programming as way to quickly solve math problems. Programming in mathematics tends to use a small subset of the programming language. A general purpose language like D has to use general purpose language. Plus the dictionary definition of "Sequence" states that directionality matters. I.E. 1,2,3 read left-to-right has a different meaning than when read right-to-left. As Andrei said, ranges can be random access, and therefore are, by definition, not sequential. http://dictionary.reference.com/browse/sequence IIRC, sequences in mathematics also imply directionality. -- Adam Wilson IRC: LightBender Project Coordinator The Horizon Project http://www.thehorizonproject.org/
Oct 03 2012
prev sibling next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
On 10/3/2012 8:04 PM, Tommi wrote:
 Renaming the concept of "range" to "sequence" would make our terminology
 more consistent with mathematics. It requires typing three more
 characters, but I think the gained consistency makes it worth it.

 http://en.wikipedia.org/wiki/Sequence

 I know, not a current issue, but better bring it up now than when it's
 too late.

I kinda thought they should have been called "sources" and "sinks", but I think it's too late for that.
Oct 03 2012
prev sibling next sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Thu, 04 Oct 2012 05:33:31 +0200
"Bernard Helyer" <b.helyer gmail.com> wrote:

 On Thursday, 4 October 2012 at 03:10:56 UTC, Alex R=F8nne Petersen=20
 wrote:
 Look, not to sound dismissive, but D3 is not a thing and likely=20
 will never be.

Well _I'll_ be dismissive. This idea, even if we were doing the D3 thing, is completely pointless. D !=3D maths. I don't know why I have to point that out, but here we are! :P =20

It's interesting that the connection between math and programming tends to lead some to consider math stuff more "proper" (maybe because it came first?) and programming more in need of being changed to conform. I think math could use to take a page from programming...specifically the first page of any "intro to programming" book. Ie, the part where it goes over proper variable naming ;) Here's the difference between programmers and mathematicians: A programmer and a mathematician walk into a lab. The programmer says, "Oops, I've run out of letters for variables! I think I'll use readable words." The mathematician had his own solution, but it was Greek to me. Nyuk nyuk nyuk. (Hey, whaddya expect? I'm a programmer, not a comedian!)
Oct 03 2012
prev sibling next sibling parent "Tommi" <tommitissari hotmail.com> writes:
On Thursday, 4 October 2012 at 05:18:20 UTC, Walter Bright wrote:
 I wish to point out that order doesn't necessarily matter with 
 a range, so there is not a 1:1 correspondence with a sequence.

 For example, the ordering of elements in an associative array 
 is arbitrary.

Oh, right. I guess in the following function, S would be a sequence if fun returned always false, as long as a != b. bool fun(S, E : ElementType!S)(E a, E b) { S s1, s2; s1.put(a); s1.put(b); s2.put(b); s2.put(a); return s1 == s2; // S is a sequence, if always returns false // S is a set, if always returns true } So, if S is an associative array, fun can (and most likely will) return true. Good that it's not called a sequence then. It would be confusing if the meaning of the terms matched only 99% of the time.
Oct 03 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Wednesday, October 03, 2012 22:13:10 Walter Bright wrote:
 I kinda thought they should have been called "sources" and "sinks", but
 I think it's too late for that.

Yes, but if we think that it's enough of an improvement, we could probably start naming parameters to range-based functions with names like that. - Jonathan M Davis
Oct 03 2012
prev sibling parent Russel Winder <russel winder.org.uk> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, 2012-10-04 at 05:05 +0200, Alex R=C3=B8nne Petersen wrote:
[=E2=80=A6]
 Look, not to sound dismissive, but D3 is not a thing and likely will=20
 never be.

D v3 will come if it comes. Implying D3 will never happen is, I believe, the wrong sort of impression to put out onto the interwebs; it implies that D v2 is a dead end in the evolutionary stakes. So for the moment D v2 is what there is and is what is being evolved. Subtly different intentions and expectations, more open-ended. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Oct 04 2012