digitalmars.D - foreach_reverse is better than ever
- Andrei Alexandrescu (7/7) Feb 13 2010 Gone, that is. Walter agreed to remove it.
- Jonathan M Davis (7/21) Feb 14 2010 I assume that this was to get rid of a keyword and reduce duplicate
- Jacob Carlborg (4/25) Feb 14 2010 It iterates backwards, all the way back to the 50s. I think "reverse" is...
- Michel Fortin (10/12) Feb 14 2010 Agree.
-
bearophile
(7/12)
Feb 14 2010
- Michel Fortin (7/10) Feb 14 2010 That certainly is a useful convention to make things easier to read.
- Leandro Lucarella (9/21) Feb 14 2010 This is a pattern in Andrei, which I think it really hurts the language
- Andrei Alexandrescu (8/24) Feb 14 2010 At least in this case being funny was not the point. I needed a name
- Mike James (13/39) Feb 14 2010 1. Contrawise
- bearophile (6/18) Feb 14 2010 Wonderful, I elect you the official namer for Phobos :-)
- Andrei Alexandrescu (5/22) Feb 14 2010 I don't mind "reversed" but it's longer than "retro" and the convention
- bearophile (4/7) Feb 14 2010 For me "retro" is acceptable. I don't love "iota" but I can accept it to...
- Justin Johansson (2/11) Feb 14 2010 Go language has "iota" so it's gotta be goodness :-)
- Adam D. Ruppe (6/7) Feb 14 2010 I like it too. Retro style never even came to my mind; I thought of
- Nick Sabalausky (7/13) Feb 14 2010 I can be happy with either 'retro' or 'reverse'. My feeling on 'iota' us...
- Andrei Alexandrescu (5/20) Feb 14 2010 retro does have something going for it that iota doesn't. Everybody I
- Igor Lesik (3/3) Feb 14 2010 opposite
- Nick Sabalausky (4/6) Feb 14 2010 "opposite" (and "inverse" as someone suggested) can have a lot of differ...
- retard (14/21) Feb 14 2010 Agreed, these names are really confusing. To me itoa sounds like "intege...
- Leandro Lucarella (7/29) Feb 15 2010 Well, english sucks, you can't fix that ;)
- KennyTM~ (2/24) Feb 16 2010 Why do you want to perform an in-place split?
- Andrei Alexandrescu (8/49) Feb 14 2010 I meant a list with other cases (aside from this particular one) in
- Mike James (3/56) Feb 14 2010 I can understand that, but the problem is - the dictionary definition of...
- Nick Sabalausky (8/12) Feb 14 2010 I think there's probably a lot of cases where dictionary definitions don...
- Mike James (4/57) Feb 14 2010 Interestingly enough, although 'invert' means turning something upside d...
- Justin Johansson (13/39) Feb 14 2010 How about
- Ary Borenszweig (2/33) Feb 14 2010 Nah, hcaerof
- retard (3/27) Feb 14 2010 It sounds like a flaw in the language design if the symbols for reversin...
- Andrei Alexandrescu (4/31) Feb 14 2010 There are two operations: reverse the thing in place, and span it in
- Ary Borenszweig (14/47) Feb 15 2010 asterite@deep-water:~$ irb
- Leandro Lucarella (8/39) Feb 15 2010 I think reverse (in-place) and reversed (returns a range that iterates i...
- Michel Fortin (28/34) Feb 15 2010 But now how do you distinguish between a function returning the
- Jacob Carlborg (5/29) Feb 15 2010 I never understood the reason for that the names need to be short. I
- Jonathan M Davis (13/18) Feb 15 2010 Clarity is very important, but if you have long names which are used
- Michel Fortin (43/54) Feb 15 2010 Well, the problem is that whether you're using something often or not
- dsimcha (7/11) Feb 15 2010 Names should be short to save typing and clutter. Of course, clarity al...
- bearophile (4/9) Feb 15 2010 http://en.wikipedia.org/wiki/Zipf_law
- Justin Johansson (6/24) Feb 15 2010 Are you trying to start a flame war?
- =?ISO-8859-1?Q?Pelle_M=E5nsson?= (3/6) Feb 15 2010 Actually, car is the reference to the first item in the cons cell, and
- Yigal Chripun (4/35) Feb 16 2010 C was designed in the dark ages when programmers actually tried to save
- Leandro Lucarella (19/43) Feb 15 2010 I'm not trying to hurt you :)
- Yigal Chripun (9/33) Feb 16 2010 As I said multitude of times before, if you want D to be commercially
- torhu (7/16) Feb 15 2010 foreach (thing; backwards(lotsOfThings))
- Daniel Murphy (5/19) Feb 14 2010 What about where foreach is being done over something other than a range...
- bearophile (9/13) Feb 14 2010 The first can be done turning an interval into syntax sugar for iota(1,1...
- bearophile (4/5) Feb 14 2010 Sorry, I meant:
- Michel Fortin (9/11) Feb 14 2010 I'm all for it, but we'll need to have 1..100 mapped to a new interval
- dsimcha (2/6) Feb 14 2010 I have no idea how you would implement retro such that it worked with op...
- dsimcha (5/24) Feb 14 2010 In general, now that we've decided to keep opApply, std.range needs to b...
- Lars T. Kyllingstad (6/17) Feb 14 2010 Let me first say that I think it's great that one of D's ugliest
- grauzone (6/25) Feb 14 2010 Now all what's left to do is to make it as efficient as the builtin
- dsimcha (2/19) Feb 14 2010 Bug 3519: http://d.puremagic.com/issues/show_bug.cgi?id=3519
- Mike James (3/17) Feb 14 2010 I think Reverse would have been a better title. Retro sounds like you mi...
- Bane (2/22) Feb 14 2010 Read about a guy that used preprocessor to change C keywords to his tast...
- Steven Schveighoffer (26/32) Feb 15 2010 Will retro work on AA's?
Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range. Andrei
Feb 13 2010
Andrei Alexandrescu wrote:Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range. AndreiI assume that this was to get rid of a keyword and reduce duplicate functionality. Though I must say that I find retro to be a bit funny. I would have expected it to be reverse. It would be clearer, I think, but it's not like it's hard to find out what retro does and remember it. - Jonathan M Davis
Feb 14 2010
On 2/14/10 09:14, Jonathan M Davis wrote:Andrei Alexandrescu wrote:It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word. /Jacob CarlborgGone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range. AndreiI assume that this was to get rid of a keyword and reduce duplicate functionality. Though I must say that I find retro to be a bit funny. I would have expected it to be reverse. It would be clearer, I think, but it's not like it's hard to find out what retro does and remember it. - Jonathan M Davis
Feb 14 2010
On 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Feb 14 2010
Michel Fortin:It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.In Python it's "reversed":<listreverseiterator object at 0x019E25B0>a = [5,7,1,3] reversed(a)[3, 1, 7, 5] Python use verbs in past tense (like "sorted", "reversed", etc) to denote something that doesn't change the given input (while "sort" sorts in-place). Bye, bearophilelist(reversed(a))
Feb 14 2010
On 2010-02-14 09:34:16 -0500, bearophile <bearophileHUGS lycos.com> said:Python use verbs in past tense (like "sorted", "reversed", etc) to denote something that doesn't change the given input (while "sort" sorts in-place).That certainly is a useful convention to make things easier to read. I'd very much like to see it used in D. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Feb 14 2010
Michel Fortin, el 14 de febrero a las 07:48 me escribiste:On 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear). -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ----------------------------------------------------------------------It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
Leandro Lucarella wrote:Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
Andrei Alexandrescu Wrote:Leandro Lucarella wrote:1. Contrawise 2. Rearward 3. AssBackwards 4. Reorientated 5. Turnedabout 6. Turnedaround 7. Inversified 8. Flipped 9. Refluxed 10. VolteFace or how about Reverse... -=mike=-Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
Mike James:1. Contrawise 2. Rearward 3. AssBackwards 4. Reorientated 5. Turnedabout 6. Turnedaround 7. Inversified 8. Flipped 9. Refluxed 10. VolteFace or how about Reverse...Wonderful, I elect you the official namer for Phobos :-) And I think Andrei meant a list of all the bad names in Phobos :-) What about "reversed"? :-) Bye, bearophile
Feb 14 2010
bearophile wrote:Mike James:I don't mind "reversed" but it's longer than "retro" and the convention doesn't scale. For example, both active and passive forms of "split" look the same. Andrei1. Contrawise 2. Rearward 3. AssBackwards 4. Reorientated 5. Turnedabout 6. Turnedaround 7. Inversified 8. Flipped 9. Refluxed 10. VolteFace or how about Reverse...Wonderful, I elect you the official namer for Phobos :-) And I think Andrei meant a list of all the bad names in Phobos :-) What about "reversed"? :-)
Feb 14 2010
Andrei Alexandrescu:I don't mind "reversed" but it's longer than "retro" and the convention doesn't scale. For example, both active and passive forms of "split" look the same.For me "retro" is acceptable. I don't love "iota" but I can accept it too. Other names of Phobos2 can be improved. Bye, bearophile
Feb 14 2010
bearophile wrote:Andrei Alexandrescu:Go language has "iota" so it's gotta be goodness :-)I don't mind "reversed" but it's longer than "retro" and the convention doesn't scale. For example, both active and passive forms of "split" look the same.For me "retro" is acceptable. I don't love "iota" but I can accept it too. Other names of Phobos2 can be improved. Bye, bearophile
Feb 14 2010
On Sun, Feb 14, 2010 at 02:26:36PM -0500, bearophile wrote:For me "retro" is acceptable.I like it too. Retro style never even came to my mind; I thought of retro rockets - the rockets that fire in reverse. -- Adam D. Ruppe http://arsdnet.net
Feb 14 2010
"bearophile" <bearophileHUGS lycos.com> wrote in message news:hl9ipc$26r1$1 digitalmars.com...Andrei Alexandrescu:I can be happy with either 'retro' or 'reverse'. My feeling on 'iota' used to be "It's not great, but I'm fine with it". But now I can't remember what the hell it does; no idea. The only things that come to mind are "Dyslexic Integer to ASCII conversion", and Futurama's "Tiny Iota? I could never be as good as him. He was a great Blurnsball player."I don't mind "reversed" but it's longer than "retro" and the convention doesn't scale. For example, both active and passive forms of "split" look the same.For me "retro" is acceptable. I don't love "iota" but I can accept it too. Other names of Phobos2 can be improved.
Feb 14 2010
Nick Sabalausky wrote:"bearophile" <bearophileHUGS lycos.com> wrote in message news:hl9ipc$26r1$1 digitalmars.com...retro does have something going for it that iota doesn't. Everybody I talked to who saw "retro" in my article on ranges knew immediately what it does, and furthermore remembered the name later. AndreiAndrei Alexandrescu:I can be happy with either 'retro' or 'reverse'. My feeling on 'iota' used to be "It's not great, but I'm fine with it". But now I can't remember what the hell it does; no idea. The only things that come to mind are "Dyslexic Integer to ASCII conversion", and Futurama's "Tiny Iota? I could never be as good as him. He was a great Blurnsball player."I don't mind "reversed" but it's longer than "retro" and the convention doesn't scale. For example, both active and passive forms of "split" look the same.For me "retro" is acceptable. I don't love "iota" but I can accept it too. Other names of Phobos2 can be improved.
Feb 14 2010
"Igor Lesik" <curoles yahoo.com> wrote in message news:mailman.58.1266181553.4461.digitalmars-d puremagic.com...opposite not very long name, bears the meaning"opposite" (and "inverse" as someone suggested) can have a lot of different meanings. Too ambiguous, IMO.
Feb 14 2010
Sun, 14 Feb 2010 14:26:36 -0500, bearophile wrote:Andrei Alexandrescu:Agreed, these names are really confusing. To me itoa sounds like "integer to string" and iota "string to integer" ("to".reverse == "ot"). I can imagine using retro in code such as: import pacman.PacmanGame; void main() { if (userWants3DVoodoo) { // real time 3d rendering with photon mapping and 9.1 192/24 sounds (new PacmanGame).start(); } else { // nice 8-bit graphics with mono 4-bit sound retro(new PacmanGame).start(); } }I don't mind "reversed" but it's longer than "retro" and the convention doesn't scale. For example, both active and passive forms of "split" look the same.For me "retro" is acceptable. I don't love "iota" but I can accept it too. Other names of Phobos2 can be improved.
Feb 14 2010
Andrei Alexandrescu, el 14 de febrero a las 12:08 me escribiste:bearophile wrote:Well, english sucks, you can't fix that ;) -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ----------------------------------------------------------------------Mike James:I don't mind "reversed" but it's longer than "retro" and the convention doesn't scale. For example, both active and passive forms of "split" look the same.1. Contrawise 2. Rearward 3. AssBackwards 4. Reorientated 5. Turnedabout 6. Turnedaround 7. Inversified 8. Flipped 9. Refluxed 10. VolteFace or how about Reverse...Wonderful, I elect you the official namer for Phobos :-) And I think Andrei meant a list of all the bad names in Phobos :-) What about "reversed"? :-)
Feb 15 2010
On Feb 15, 10 02:08, Andrei Alexandrescu wrote:bearophile wrote:Why do you want to perform an in-place split?Mike James:I don't mind "reversed" but it's longer than "retro" and the convention doesn't scale. For example, both active and passive forms of "split" look the same. Andrei1. Contrawise 2. Rearward 3. AssBackwards 4. Reorientated 5. Turnedabout 6. Turnedaround 7. Inversified 8. Flipped 9. Refluxed 10. VolteFace or how about Reverse...Wonderful, I elect you the official namer for Phobos :-) And I think Andrei meant a list of all the bad names in Phobos :-) What about "reversed"? :-)
Feb 16 2010
Mike James wrote:Andrei Alexandrescu Wrote:I meant a list with other cases (aside from this particular one) in which choices of names were unfortunate. I thought the following is clear but let me state it: in this particular case, using "reverse" is not desirable because the name already exists as an array property. If we drop the existing feature and choose "reverse" for the new feature, code will silently change semantics. AndreiLeandro Lucarella wrote:1. Contrawise 2. Rearward 3. AssBackwards 4. Reorientated 5. Turnedabout 6. Turnedaround 7. Inversified 8. Flipped 9. Refluxed 10. VolteFace or how about Reverse... -=mike=-Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
Andrei Alexandrescu Wrote:Mike James wrote:I can understand that, but the problem is - the dictionary definition of 'retro' is 'associated with or revived from the past'. It doesn't correctly describe the action. It could generate many hours of semiotic arguements... ;=) -=mike=-Andrei Alexandrescu Wrote:I meant a list with other cases (aside from this particular one) in which choices of names were unfortunate. I thought the following is clear but let me state it: in this particular case, using "reverse" is not desirable because the name already exists as an array property. If we drop the existing feature and choose "reverse" for the new feature, code will silently change semantics. AndreiLeandro Lucarella wrote:1. Contrawise 2. Rearward 3. AssBackwards 4. Reorientated 5. Turnedabout 6. Turnedaround 7. Inversified 8. Flipped 9. Refluxed 10. VolteFace or how about Reverse... -=mike=-Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
"Mike James" <foo bar.com> wrote in message news:hl9i1q$24m0$1 digitalmars.com...I can understand that, but the problem is - the dictionary definition of 'retro' is 'associated with or revived from the past'. It doesn't correctly describe the action. It could generate many hours of semiotic arguements... ;=)I think there's probably a lot of cases where dictionary definitions don't quite match a word's usage in the programming world. "Kill", "thread", "string", "rake" (the ruby build tool) all come to mind. Of course, "retro" might be argued to be more of a stretch than some of those, but you can also think of "retro" just referring to the prefix "retro" (which does basically just mean "backwards", AIUI) rather than the actual word "retro".
Feb 14 2010
Andrei Alexandrescu Wrote:Mike James wrote:Interestingly enough, although 'invert' means turning something upside down, according to the dictionary, it can also imply reversing something... would 'Invert' be applicable? -=mike=-Andrei Alexandrescu Wrote:I meant a list with other cases (aside from this particular one) in which choices of names were unfortunate. I thought the following is clear but let me state it: in this particular case, using "reverse" is not desirable because the name already exists as an array property. If we drop the existing feature and choose "reverse" for the new feature, code will silently change semantics. AndreiLeandro Lucarella wrote:1. Contrawise 2. Rearward 3. AssBackwards 4. Reorientated 5. Turnedabout 6. Turnedaround 7. Inversified 8. Flipped 9. Refluxed 10. VolteFace or how about Reverse... -=mike=-Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
Andrei Alexandrescu wrote:Leandro Lucarella wrote:How about esrever with credit for original idea going to highly creative Unix script language designers as in if ... fi esrever has attributes (b) and (c) (definitely memorable). (a), well no, arguably it's not short. so I guess it really is a no brainer, then. How about ver )-: nitsuJMichel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
Justin Johansson wrote:Andrei Alexandrescu wrote:Nah, hcaerofLeandro Lucarella wrote:How about esreverMichel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
Sun, 14 Feb 2010 11:18:02 -0600, Andrei Alexandrescu wrote:Leandro Lucarella wrote:It sounds like a flaw in the language design if the symbols for reversing arrays and ranges somehow conflict.Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list.On 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
retard wrote:Sun, 14 Feb 2010 11:18:02 -0600, Andrei Alexandrescu wrote:There are two operations: reverse the thing in place, and span it in retrograde order. AndreiLeandro Lucarella wrote:It sounds like a flaw in the language design if the symbols for reversing arrays and ranges somehow conflict.Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list.On 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 14 2010
Andrei Alexandrescu wrote:retard wrote:asterite deep-water:~$ irb irb(main):001:0> a = [1, 2, 3] => [1, 2, 3] irb(main):002:0> a.reverse => [3, 2, 1] irb(main):003:0> a => [1, 2, 3] irb(main):004:0> a.reverse! => [3, 2, 1] irb(main):005:0> a => [3, 2, 1] irb(main):006:0> Aaaah... ruby <3Sun, 14 Feb 2010 11:18:02 -0600, Andrei Alexandrescu wrote:There are two operations: reverse the thing in place, and span it in retrograde order. AndreiLeandro Lucarella wrote:It sounds like a flaw in the language design if the symbols for reversing arrays and ranges somehow conflict.Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list.On 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 15 2010
Andrei Alexandrescu, el 14 de febrero a las 20:24 me escribiste:retard wrote:I think reverse (in-place) and reversed (returns a range that iterates in reverse order) are *very* clear in terms of that distinction. -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ----------------------------------------------------------------------Sun, 14 Feb 2010 11:18:02 -0600, Andrei Alexandrescu wrote:There are two operations: reverse the thing in place, and span it in retrograde order.Leandro Lucarella wrote:It sounds like a flaw in the language design if the symbols for reversing arrays and ranges somehow conflict.Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list.On 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 15 2010
On 2010-02-15 09:04:11 -0500, Leandro Lucarella <llucax gmail.com> said:Andrei Alexandrescu, el 14 de febrero a las 20:24 me escribiste:But now how do you distinguish between a function returning the reversed form of something and a function returning true when that thing is reversed? :-) In Ruby syntax things are generally pretty easy: Cocoa would use a slightly different notation: [something reverse]; // reverse in place [something reversedSomething]; // reverse a copy [something isReversed]; // return whether something is reversed or not Both conventions are very clear and scale well even for words like 'split' which are identical in their past and present tense. It's unclear to me how we want this to be done in D... something.reverse(); // reverse in place something.reversed; // reverse a copy something.reversed(); // ditto something.reverse(); // ditto something.reversed; // return whether something is reversed or not something.isReversed; // ditto If we want some consistency, someone with authority over Phobos will have to draw some guidelines about this, and sooner the better. -- Michel Fortin michel.fortin michelf.com http://michelf.com/There are two operations: reverse the thing in place, and span it in retrograde order.I think reverse (in-place) and reversed (returns a range that iterates in reverse order) are *very* clear in terms of that distinction.
Feb 15 2010
On 2/14/10 18:18, Andrei Alexandrescu wrote:Leandro Lucarella wrote:I never understood the reason for that the names need to be short. I think the most important thing is that the names are clear. Just look at the C standard library, it's horrible, almost every name is an abbreviation of some kind.Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 15 2010
Jacob Carlborg wrote:I never understood the reason for that the names need to be short. I think the most important thing is that the names are clear. Just look at the C standard library, it's horrible, almost every name is an abbreviation of some kind.Clarity is very important, but if you have long names which are used frequently, it can quickly result in long lines of code which end up on multiple lines and can be hard to read. If a word isn't used very often, then it's not that big a deal, but the more often it's used - especially when it can be used multiple times on the same line - the worse it gets. Really, the ideal situation is to find words which are short and clear, but a balance must be struck between the two regardless. Too long and it's cumbersome. Too short and it's likely to be unclear. There's no question that programmers often use words for variable names and such which are ludicrously short and unclear, but long words can be a problem too. - Jonathan M Davis
Feb 15 2010
On 2010-02-15 08:59:43 -0500, Jonathan M Davis <jmdavisProg gmail.com> said:Clarity is very important, but if you have long names which are used frequently, it can quickly result in long lines of code which end up on multiple lines and can be hard to read. If a word isn't used very often, then it's not that big a deal, but the more often it's used - especially when it can be used multiple times on the same line - the worse it gets.Well, the problem is that whether you're using something often or not depends on the context. If in a context your function name is used once or two, but in another it's used a lot, which prevails: shortness or clarity? I'd tend to put clarity over short names in D because the language makes it very easy to create shorter aliases limited in scope when the need arise. But you shouldn't repeat the argument types nor the module's name: the language takes care of that for you.Really, the ideal situation is to find words which are short and clear, but a balance must be struck between the two regardless. Too long and it's cumbersome. Too short and it's likely to be unclear.There's no question that programmers often use words for variable names and such which are ludicrously short and unclear, but long words can be a problem too.I think it's a question of locality. The broader is the scope of a name the more self-explaining the name should be. As an extreme example, I don't mind much seeing a local variable named 'x' in a short function, but I wouldn't accept that as a member variable in a class, and even less for a global variable. It's easy for someone to create short names when he is all absorbed in what he's doing. But I think it generally takes some detachment to get the names right for a public API. Ideally, API names should be understandable as soon as you understand the underlying concepts. But even more important is that __functions should never be understood wrong__, the name should be clear enough to ensure that. I don't think std.range fare very well at this readability test. Take this example: int[] array = [1,2,3,4,5,6,7,8,9]; auto five = take(5, array); writeln(array); // what are you expecting here? In the case above, 'take' returns a range that lazily takes N elements when you iterate over it. If you don't use the returned range, 'take' is as good as a no-op. But this subtle interaction isn't very clear when you just read the code. Last week I defined my own function named 'take' for some kind of parser, advancing the range by the number of specified elements and returning an array of all the 'taken' elements. Then I realized it had the same name as the one above but with this subtle difference in semantics, subtle but very important for what I was doing. I renamed my function since then to make things less confusing, but I'm still a little shaken by this whole incident. I think the lazy nature of 'take' should be visible when calling the function. This could be achieved by a name change, or perhaps in another way. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Feb 15 2010
== Quote from Jacob Carlborg (doob me.com)'s articleI never understood the reason for that the names need to be short. I think the most important thing is that the names are clear. Just look at the C standard library, it's horrible, almost every name is an abbreviation of some kind.Names should be short to save typing and clutter. Of course, clarity also matters. I tend to prefer short names for frequently used language and library constructs that everyone who has been using the language for more than two weeks should know. Longer names have their use in **your** programs and in less frequently used constructs, where the overhead of memorizing what a short, unclear name means is less than the overhead of typing a long name.
Feb 15 2010
dsimcha:I tend to prefer short names for frequently used language and library constructs that everyone who has been using the language for more than two weeks should know. Longer names have their use in **your** programs and in less frequently used constructs, where the overhead of memorizing what a short, unclear name means is less than the overhead of typing a long name.http://en.wikipedia.org/wiki/Zipf_law Bye, bearophile
Feb 15 2010
Are you trying to start a flame war? What's wrong with LISP's car and cdr? Isn't it obvious to all and sundry that car is the head element of a singly linked list and cdr is the rest of the list with the head element removed? Justin Johansson :-) :-) :-)I never understood the reason for that the names need to be short. I think the most important thing is that the names are clear. Just look at the C standard library, it's horrible, almost every name is an abbreviation of some kind.This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. Andrei
Feb 15 2010
On 02/15/2010 09:44 PM, Justin Johansson wrote:Isn't it obvious to all and sundry that car is the head element of a singly linked list and cdr is the rest of the list with the head element removed?Actually, car is the reference to the first item in the cons cell, and cdr is the second. Not just lists, you know. :)
Feb 15 2010
On 15/02/2010 15:00, Jacob Carlborg wrote:On 2/14/10 18:18, Andrei Alexandrescu wrote:C was designed in the dark ages when programmers actually tried to save bytes in their extremely limited hardware. That same age brought us the tab character, Y2k bug and FORTRAN.Leandro Lucarella wrote:I never understood the reason for that the names need to be short. I think the most important thing is that the names are clear. Just look at the C standard library, it's horrible, almost every name is an abbreviation of some kind.Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 16 2010
Andrei Alexandrescu, el 14 de febrero a las 11:18 me escribiste:Leandro Lucarella wrote:I'm not trying to hurt you :) I just pointing out that you sometimes pick up clever or creative or niche names, which might look like a good idea to you but it's not for me. They are different points of view, I'm sure a lot of people would "look, D has these very clever names, it sure is a good language", but I think, from a practical point of view, that it's a bad idea because they are less natural and harder to learn, remember and *read*.Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would beOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.of course best if names that arguably hurt the language were changed, so please compile a list.Well, they were discussed several times, sometimes with huge threads (like the range methods names). iota() is another really hard to remember/understand name for me (I said that before). I just didn't know what iota() was before you used it in phobos. I even couldn't follow some examples before I searched what iota was (which it took me some time because I was a little embarrassed that I didn't knew its meaning =). -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ----------------------------------------------------------------------
Feb 15 2010
On 14/02/2010 19:18, Andrei Alexandrescu wrote:Leandro Lucarella wrote:As I said multitude of times before, if you want D to be commercially successful, you need to change your priorities. the *most* important thing to have is _clear_ and _understandable_ names by a wide international audience. The *least* important thing is shortness. you might argue as long as you want that C++/D is technically superior to Java, but fact remains that Java is the favorite language in enterprise. One huge factor which helps this is of course the clear naming scheme in its stdlib.Michel Fortin, el 14 de febrero a las 07:48 me escribiste:At least in this case being funny was not the point. I needed a name that was (a) short, (b) different from "reverse", (c) memorable. It is understood that other paint colors are available, but please don't forget to give a little love to the painter. :o) It would be of course best if names that arguably hurt the language were changed, so please compile a list. AndreiOn 2010-02-14 05:12:41 -0500, Jacob Carlborg <doob me.com> said:This is a pattern in Andrei, which I think it really hurts the language (the names are very clever and funny, but that shouldn't be the point of a name, a name should be clear).It iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.Agree. My dictionary says: "retro": imitative of a style, fashion, or design from the recent past. It's an amusing name in the way Andrei likes it, but the meaning isn't very clear. "reverse" would be a better name.
Feb 16 2010
On 14.02.2010 11:12, Jacob Carlborg wrote:On 2/14/10 09:14, Jonathan M Davis wrote:foreach (thing; backwards(lotsOfThings)) { } 'backwards' would be fine by me. But then I don't seem to iterate in reverse a whole lot, so it doesn't bother me that it's twice a long as 'retro'. Is that really a problem?Though I must say that I find retro to be a bit funny. I would have expected it to be reverse. It would be clearer, I think, but it's not like it's hard to find out what retro does and remember it. - Jonathan M DavisIt iterates backwards, all the way back to the 50s. I think "reverse" is a much better word.
Feb 15 2010
Andrei Alexandrescu Wrote:Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range. AndreiWhat about where foreach is being done over something other than a range? eg. foreach(i; 1..100) foreach(v; structwithopapply)
Feb 14 2010
Daniel Murphy:What about where foreach is being done over something other than a range? eg. foreach(i; 1..100) foreach(v; structwithopapply)The first can be done turning an interval into syntax sugar for iota(1,100): The foreach(i; retro(1 .. 100)) Otherwise the interval syntax can grow the step, as in Python and other languages (in D the step might even be a compile-time constant): The foreach(i; 1 .. 100 : -1) The second gives no problems if retro is well done: foreach(v; retro(structWithopApplyReverse)) Bye, bearophile
Feb 14 2010
The foreach(i; 1 .. 100 : -1)Sorry, I meant: foreach(i; 99 .. 0 : -1) Bye, bearophile
Feb 14 2010
On 2010-02-14 07:15:55 -0500, bearophile <bearophileHUGS lycos.com> said:The first can be done turning an interval into syntax sugar for iota(1,100): The foreach(i; retro(1 .. 100))I'm all for it, but we'll need to have 1..100 mapped to a new interval type for this to work. Then you can easily implement this (among many other interesting things): auto reverse(Interval!int interval) { ... } -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Feb 14 2010
== Quote from bearophile (bearophileHUGS lycos.com)'s articleThe second gives no problems if retro is well done: foreach(v; retro(structWithopApplyReverse)) Bye, bearophileI have no idea how you would implement retro such that it worked with opApplyReverse.
Feb 14 2010
== Quote from Daniel Murphy (yebbliesnospam gmail.com)'s articleAndrei Alexandrescu Wrote:In general, now that we've decided to keep opApply, std.range needs to be reworked a little to make it coexist as peacefully as possible with ranges. For this case, I guess retro could simply have an opApply method that forwards to structwithopapply's opApplyReverse method.Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range. AndreiWhat about where foreach is being done over something other than a range? eg. foreach(i; 1..100) foreach(v; structwithopapply)
Feb 14 2010
Andrei Alexandrescu wrote:Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range.Let me first say that I think it's great that one of D's ugliest keywords is going away. But does retro (or ranges in general) support iteration over both index and element? foreach_reverse(i, e; foo) { ... } -Lars
Feb 14 2010
Lars T. Kyllingstad wrote:Andrei Alexandrescu wrote:Now all what's left to do is to make it as efficient as the builtin functionality.Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range.Let me first say that I think it's great that one of D's ugliest keywords is going away. But does retro (or ranges in general) support iteration over both index and element? foreach_reverse(i, e; foo) { ... }And will it be able to parse utf-8 backwards? I assume proper utf-8 support with ranges (or whatever is planned) isn't implemented yet, so I didn't test it.-Lars
Feb 14 2010
== Quote from Lars T. Kyllingstad (public kyllingen.NOSPAMnet)'s articleAndrei Alexandrescu wrote:Bug 3519: http://d.puremagic.com/issues/show_bug.cgi?id=3519Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range.Let me first say that I think it's great that one of D's ugliest keywords is going away. But does retro (or ranges in general) support iteration over both index and element? foreach_reverse(i, e; foo) { ... } -Lars
Feb 14 2010
Andrei Alexandrescu Wrote:Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range. AndreiI think Reverse would have been a better title. Retro sounds like you might be using only 8088 assembler instructions in the output... -=mike=-
Feb 14 2010
Mike James Wrote:Andrei Alexandrescu Wrote:Read about a guy that used preprocessor to change C keywords to his taste on company project. Nearly caused heart attack to next guy in line to maintain that code. Maybe we could keep both keywords :DGone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range. AndreiI think Reverse would have been a better title. Retro sounds like you might be using only 8088 assembler instructions in the output... -=mike=-
Feb 14 2010
On Sun, 14 Feb 2010 00:53:31 -0500, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Gone, that is. Walter agreed to remove it. To achieve the functionality of foreach_reverse (r) { ... } use foreach (retro(r)) { ... } using retro in std.range.Will retro work on AA's? Other than that (and how to do foreach(1..100) that others have brought up) I think this is a great move. BTW, for those bemoaning the loss of opApplyReverse, it is easy to change this: struct S(T) { int opApplyReverse(int delegate(ref T t) dg) {...} } S!int s; foreach_reverse(i; s) {...} into this: struct S(T) { int inReverse(int delegate(ref T t) dg) {...} } S!int s; foreach(i; &s.inReverse){...} Of course, I'd prefer it without the &, but that is a separate issue (see bug http://d.puremagic.com/issues/show_bug.cgi?id=2498) Also, while your attention is focused on foreach, look at this bug: http://d.puremagic.com/issues/show_bug.cgi?id=2443 :) -Steve
Feb 15 2010