digitalmars.D.announce - I have a suggestion.
- YonggangLuo <yonggangluo gmail.com> May 16 2007
- freeagle <dalibor.free gmail.com> May 16 2007
- Pragma <ericanderton yahoo.removeme.com> May 16 2007
- Ary Manzana <ary esperanto.org.ar> May 16 2007
- antonio <antonio abrevia.net> May 16 2007
- BCS <BCS pathlink.com> May 16 2007
- Oskar Linde <oskar.lindeREM OVEgmail.com> May 16 2007
- janderson <askme me.com> May 16 2007
- Dave <Dave_member pathlink.com> May 16 2007
- Brian Byrne <bdbyrne wisc.edu> May 16 2007
- renoX <renosky free.fr> May 16 2007
- Bill Baxter <dnewsgroup billbaxter.com> May 16 2007
- Brian Byrne <bdbyrne wisc.edu> May 16 2007
- janderson <askme me.com> May 16 2007
- Bastiaan Veelo <Bastiaan Veelo.net> May 16 2007
- "Anders Bergh" <anders andersman.org> May 17 2007
- Mikola Lysenko <mclysenk mtu.edu> May 16 2007
- Justin C Calvarese <technocrat7 gmail.com> May 17 2007
- Sean Kelly <sean f4.ca> May 17 2007
- Bill Baxter <dnewsgroup billbaxter.com> May 17 2007
- Derek Parnell <derek nomail.afraid.org> May 17 2007
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> May 17 2007
- Pragma <ericanderton yahoo.removeme.com> May 18 2007
- Charles D Hixson <charleshixsn earthlink.net> May 18 2007
- "Jb" <jb nowhere.com> May 17 2007
i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
May 16 2007
YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I find "frr" very cryptic. consider this: if(reverse) { frr(int i, array) { ... } } else { foreach(int i, array) { ... } } Those keywords doesn't seem related, but would in fact provide similar funcitonality. I too would like to see this "foreach_reverse" solved in other way, but not with another keyword freeagle
May 16 2007
freeagle wrote:YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I find "frr" very cryptic. consider this: if(reverse) { frr(int i, array) { ... } } else { foreach(int i, array) { ... } } Those keywords doesn't seem related, but would in fact provide similar funcitonality. I too would like to see this "foreach_reverse" solved in other way, but not with another keyword freeagle
I agree with you completely. While I understand the goal behind "foreach_reverse" is to put optimal array-traversal-loop generation in the hands of the compiler (read: faster than opApply), the keyword itself remains the only real wart. The keyword "rforeach" would have made a much better candidate IMO. -- - EricAnderton at yahoo
May 16 2007
I do like foreach_reverse. It's a very explicity name, and it doesn't appear often. And I guess an editor could provide a template for it, so just typing "fore" and pressing the down arrow will be enough. Pragma escribió:freeagle wrote:YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I find "frr" very cryptic. consider this: if(reverse) { frr(int i, array) { ... } } else { foreach(int i, array) { ... } } Those keywords doesn't seem related, but would in fact provide similar funcitonality. I too would like to see this "foreach_reverse" solved in other way, but not with another keyword freeagle
I agree with you completely. While I understand the goal behind "foreach_reverse" is to put optimal array-traversal-loop generation in the hands of the compiler (read: faster than opApply), the keyword itself remains the only real wart. The keyword "rforeach" would have made a much better candidate IMO.
May 16 2007
Pragma wrote:freeagle wrote:YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I find "frr" very cryptic. consider this: if(reverse) { frr(int i, array) { ... } } else { foreach(int i, array) { ... } } Those keywords doesn't seem related, but would in fact provide similar funcitonality. I too would like to see this "foreach_reverse" solved in other way, but not with another keyword freeagle
I agree with you completely. While I understand the goal behind "foreach_reverse" is to put optimal array-traversal-loop generation in the hands of the compiler (read: faster than opApply), the keyword itself remains the only real wart. The keyword "rforeach" would have made a much better candidate IMO.
foreach(int i; reversed array) compiler must act in the optimal way.
May 16 2007
antonio wrote:I think the more "algebraic" way could be something like foreach(int i; reversed array) compiler must act in the optimal way.
or we could take a hint from scope and do: foreach(reverse)(i;arr) that leaves the door open for things like foreach(stride, 5)(i;arr) {} and foreach(heaptree)(i;arr) {} the overloads could be something like opApply(char[] : "reverse")(int delegate(inout int));
May 16 2007
BCS skrev:antonio wrote:I think the more "algebraic" way could be something like foreach(int i; reversed array) compiler must act in the optimal way.
or we could take a hint from scope and do: foreach(reverse)(i;arr) that leaves the door open for things like foreach(stride, 5)(i;arr) {} and foreach(heaptree)(i;arr) {} the overloads could be something like opApply(char[] : "reverse")(int delegate(inout int));
Not that I havn't said it before, but there doesn't need to be any language changes at all. Removing foreach_reverse altogether doesn't remove any expressiveness -- just a special case. If the compiler was smart enough to 1) be able to inline functions with loops, and 2) be able to inline const (at compile time known) delegate calls (which it possibly does already), there would be no need for this special case keyword. foreach(i; arr), foreach(i; reverse(arr)), foreach(i; heaptree(arr)), and so on, could all be equally efficient. /Oskar
May 16 2007
Oskar Linde wrote:BCS skrev:antonio wrote:I think the more "algebraic" way could be something like foreach(int i; reversed array) compiler must act in the optimal way.
or we could take a hint from scope and do: foreach(reverse)(i;arr) that leaves the door open for things like foreach(stride, 5)(i;arr) {} and foreach(heaptree)(i;arr) {} the overloads could be something like opApply(char[] : "reverse")(int delegate(inout int));
Not that I havn't said it before, but there doesn't need to be any language changes at all. Removing foreach_reverse altogether doesn't remove any expressiveness -- just a special case. If the compiler was smart enough to 1) be able to inline functions with loops, and 2) be able to inline const (at compile time known) delegate calls (which it possibly does already), there would be no need for this special case keyword. foreach(i; arr), foreach(i; reverse(arr)), foreach(i; heaptree(arr)), and so on, could all be equally efficient. /Oskar
I agree. I still don't understand why the compiler can't have a special inbuilt reverse keyword as an attribute of arrays, that it can optimize away when it needs to. -Joel
May 16 2007
janderson wrote:Oskar Linde wrote: I agree. I still don't understand why the compiler can't have a special inbuilt reverse keyword as an attribute of arrays, that it can optimize away when it needs to. -Joel
There's array.reverse, but of course it modifies the data. Instead of foreach_reverse, how about 'reveach' <g> - Dave
May 16 2007
YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I tend to side on being explicit, so I don't think "frr" would be that great of a name change. But I will agree that foreach_reverse looks fairly ugly (more than a keyword should). Anyways, along your lines I think "fer" (ForEachReverse) would be a more appropriate abbreviation. I can give it association to hillbilly speech, "Fer dat dem dere list [insert mental image of a scraggly old man in overalls holding a list upside-down]..." More seriously, I think a better keyword would be rforeach, revforeach, or something similarly parallel. Something about reading underscores in keywords (*cough* C++) makes me cringe at the sight. Brian Byrne
May 16 2007
Brian Byrne a écrit :More seriously, I think a better keyword would be rforeach, revforeach, or something similarly parallel. Something about reading underscores in keywords (*cough* C++) makes me cringe at the sight. Brian Byrne
While_a_shorter_keyword_could_be_better_whats_wrong_with_underscores? BasicallyThereAreTwoChoiceToLinkSeveralWordsTogetherEitherUnderscoreOrUsingCase. Guess which one is easier one the eye with the two above sentence? I *really* don't understand those who prefer CamelCase, it's harder to read, it doesn't work well with shortcuts such as IBM, etc, the only good point of CamelCase is that it is a little more compact, bah. renoX
May 16 2007
renoX wrote:Brian Byrne a écrit :More seriously, I think a better keyword would be rforeach, revforeach, or something similarly parallel. Something about reading underscores in keywords (*cough* C++) makes me cringe at the sight. Brian Byrne
While_a_shorter_keyword_could_be_better_whats_wrong_with_underscores? BasicallyThereAreTwoChoiceToLinkSeveralWordsTogetherEitherUn erscoreOrUsingCase. Guess which one is easier one the eye with the two above sentence? I *really* don't understand those who prefer CamelCase, it's harder to read, it doesn't work well with shortcuts such as IBM, etc, the only good point of CamelCase is that it is a little more compact, bah. renoX
Yeh, underscores are good. Just not in a keyword. A camelCase keyword would be just as bad. --bb
May 16 2007
renoX wrote:Brian Byrne a écrit :More seriously, I think a better keyword would be rforeach, revforeach, or something similarly parallel. Something about reading underscores in keywords (*cough* C++) makes me cringe at the sight. Brian Byrne
While_a_shorter_keyword_could_be_better_whats_wrong_with_underscores? BasicallyThereAreTwoChoiceToLinkSeveralWordsTogetherEitherUn erscoreOrUsingCase. Guess which one is easier one the eye with the two above sentence? I *really* don't understand those who prefer CamelCase, it's harder to read, it doesn't work well with shortcuts such as IBM, etc, the only good point of CamelCase is that it is a little more compact, bah. renoX
I wasn't implying camel case would be better, rather I believe that would also be the wrong way to go. As you probably know, the C++ casts are big, long, and ugly for the sake of being big, long, and ugly (to discourage their use). I don't think that's so much the aim for foreach_reverse. It would just be nicer to shorten it, is all. Brian Byrne
May 16 2007
renoX wrote:Brian Byrne a écrit :More seriously, I think a better keyword would be rforeach, revforeach, or something similarly parallel. Something about reading underscores in keywords (*cough* C++) makes me cringe at the sight. Brian Byrne
While_a_shorter_keyword_could_be_better_whats_wrong_with_underscores? BasicallyThereAreTwoChoiceToLinkSeveralWordsTogetherEitherUn erscoreOrUsingCase. Guess which one is easier one the eye with the two above sentence? I *really* don't understand those who prefer CamelCase, it's harder to read, it doesn't work well with shortcuts such as IBM, etc, the only good point of CamelCase is that it is a little more compact, bah. renoX
I find that camel case allows me to see things as one unit rather then several. But that's just me. I automatically see your first example as many different symbols rather then just one. -Joel
May 16 2007
Well there is one that is - no longer than "foreach" - not a concatenation of words - not an abbreviation - rather illustrative "hcaerof" ...It is also cryptic - you can't please everyone. Just kidding. Bastiaan. Brian Byrne wrote:YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I tend to side on being explicit, so I don't think "frr" would be that great of a name change. But I will agree that foreach_reverse looks fairly ugly (more than a keyword should). Anyways, along your lines I think "fer" (ForEachReverse) would be a more appropriate abbreviation. I can give it association to hillbilly speech, "Fer dat dem dere list [insert mental image of a scraggly old man in overalls holding a list upside-down]..." More seriously, I think a better keyword would be rforeach, revforeach, or something similarly parallel. Something about reading underscores in keywords (*cough* C++) makes me cringe at the sight. Brian Byrne
May 16 2007
Would be a perfect easter egg, but I guess those have no place in a programming language. On 5/17/07, Bastiaan Veelo <Bastiaan veelo.net> wrote:Well there is one that is - no longer than "foreach" - not a concatenation of words - not an abbreviation - rather illustrative "hcaerof" ...It is also cryptic - you can't please everyone. Just kidding. Bastiaan. Brian Byrne wrote:YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I tend to side on being explicit, so I don't think "frr" would be that great of a name change. But I will agree that foreach_reverse looks fairly ugly (more than a keyword should). Anyways, along your lines I think "fer" (ForEachReverse) would be a more appropriate abbreviation. I can give it association to hillbilly speech, "Fer dat dem dere list [insert mental image of a scraggly old man in overalls holding a list upside-down]..." More seriously, I think a better keyword would be rforeach, revforeach, or something similarly parallel. Something about reading underscores in keywords (*cough* C++) makes me cringe at the sight. Brian Byrne
-- Anders
May 17 2007
YonggangLuo Wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I like this idea, but "frr" is downright inconsistent with the rest of the language. What if we do something like this: ~foreach( x; arr ) While reducing keystrokes, recycling a unary operator also cuts down keyword bloat. My only concern is that it might be too subtle. I suspect that for non-English users, there would be few tears shed over the death of "foreach_reverse." Ultimately, the best option might be to do as Tom S. and others have suggested and simply axe it entirely. Using a clever template you could actually implement a very efficient reverse foreach within the standard library. -Mik
May 16 2007
YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I agree that foreach_reverse is way too long for a keyword. Also, it has that unslightly underscore. I think that frr is a little too short. Since it's a keyword that will be rarely used, newcomers to D will likely get confused. I'm "voting" for foreachrev, but here's a whole list of decent alternatives to the current "foreach_reverse" mess: 1. foreachrev 2. rforeach 3. revforeach -- jcc7
May 17 2007
Justin C Calvarese wrote:YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I agree that foreach_reverse is way too long for a keyword. Also, it has that unslightly underscore. I think that frr is a little too short. Since it's a keyword that will be rarely used, newcomers to D will likely get confused. I'm "voting" for foreachrev, but here's a whole list of decent alternatives to the current "foreach_reverse" mess: 1. foreachrev 2. rforeach 3. revforeach
I still like: foreach - unordered? foreach(fwd) - explicitly forward foreach(rev) - explicitly reverse foreach(any) - unordered Sean
May 17 2007
Sean Kelly wrote:Justin C Calvarese wrote:YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I agree that foreach_reverse is way too long for a keyword. Also, it has that unslightly underscore. I think that frr is a little too short. Since it's a keyword that will be rarely used, newcomers to D will likely get confused. I'm "voting" for foreachrev, but here's a whole list of decent alternatives to the current "foreach_reverse" mess: 1. foreachrev 2. rforeach 3. revforeach
I still like: foreach - unordered? foreach(fwd) - explicitly forward foreach(rev) - explicitly reverse foreach(any) - unordered
Yep, or something of that ilk. It's very D-like; it means we can get rid of the special-case keyword; and it leaves wiggle room for future innovation, like foreach(any), foreach(parallel), etc., without requiring more keywords. The only thing better than that would be what Oskar said: to improve the compiler to the point that a construct like foreach(e; reversed(A)) could be as efficient as the current hard-coded foreach_reverse behavior. --bb
May 17 2007
On Thu, 17 May 2007 10:58:36 -0700, Sean Kelly wrote:I still like: foreach - unordered? foreach(fwd) - explicitly forward foreach(rev) - explicitly reverse foreach(any) - unordered
I like this style of syntax for D too. The keyword "foreach_reverse" doesn't go with the rest of D's style. I also like the styles in which the order qualification is more visually linked to the array reference itself. Something along the lines of ... foreach( elem, array.order.fwd) foreach( elem, array.order.rev) foreach( elem, array.order.none) -- Derek (skype: derek.j.parnell) Melbourne, Australia "Justice for David Hicks!" 18/05/2007 10:09:43 AM
May 17 2007
"Derek Parnell" <derek nomail.afraid.org> wrote in message news:dabhxjbzr6ww$.1shkxsv5aswsm$.dlg 40tude.net...I also like the styles in which the order qualification is more visually linked to the array reference itself. Something along the lines of ... foreach( elem, array.order.fwd) foreach( elem, array.order.rev) foreach( elem, array.order.none)
I agree. foreach(elem; array)(reverse) { ... } Though that somehow looks a little disconnected. foreach(elem; array; reverse) { } Hm. foreach(elem; array, "reverse") { } oops, there's some MiniD. ;)
May 17 2007
Jarrett Billingsley wrote:Hm. foreach(elem; array, "reverse") { } oops, there's some MiniD. ;)
/me slaps Jarret with a trout labeled "shameless self promotion" PS, try Enki. :p -- - EricAnderton at yahoo
May 18 2007
Sean Kelly wrote:Justin C Calvarese wrote:YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I agree that foreach_reverse is way too long for a keyword. Also, it has that unslightly underscore. I think that frr is a little too short. Since it's a keyword that will be rarely used, newcomers to D will likely get confused. I'm "voting" for foreachrev, but here's a whole list of decent alternatives to the current "foreach_reverse" mess: 1. foreachrev 2. rforeach 3. revforeach
I still like: foreach - unordered? foreach(fwd) - explicitly forward foreach(rev) - explicitly reverse foreach(any) - unordered Sean
become really common, D will have already built in a construct for parallelization...the any option. I suppose that one *could* add a "parallelize" option, but that could *only* be advisory, and as such any is just as good.
May 18 2007
"Justin C Calvarese" <technocrat7 gmail.com> wrote in message news:f2i4gg$5op$1 digitalmars.com...YonggangLuo wrote:i think it's will be a good idea to replace "foreach_reverse" with "frr". "foreach_reverse" is too long as a keyword
I agree that foreach_reverse is way too long for a keyword. Also, it has that unslightly underscore. I think that frr is a little too short. Since it's a keyword that will be rarely used, newcomers to D will likely get confused. I'm "voting" for foreachrev, but here's a whole list of decent alternatives to the current "foreach_reverse" mess: 1. foreachrev 2. rforeach 3. revforeach
4. reveach
May 17 2007









Ary Manzana <ary esperanto.org.ar> 