May 16, 2007 Re: I have a suggestion. | ||||
---|---|---|---|---|
| ||||
Posted in reply to renoX | 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?
>
> 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
Yeh, underscores are good. Just not in a keyword. A camelCase keyword would be just as bad.
--bb
|
May 16, 2007 Re: I have a suggestion. | ||||
---|---|---|---|---|
| ||||
Posted in reply to renoX | 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?
>
> 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
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 17, 2007 Re: I have a suggestion. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Oskar Linde | 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 17, 2007 Re: I have a suggestion. | ||||
---|---|---|---|---|
| ||||
Posted in reply to renoX | 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?
>
> 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
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 17, 2007 Re: I have a suggestion. | ||||
---|---|---|---|---|
| ||||
Posted in reply to janderson | 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 17, 2007 Re: I have a suggestion. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Byrne | 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 17, 2007 Re: I have a suggestion. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bastiaan Veelo | 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 Ideas for shortening "foreach_reverse" (was Re: I have a suggestion.) | ||||
---|---|---|---|---|
| ||||
Posted in reply to YonggangLuo | 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 Re: Ideas for shortening "foreach_reverse" (was Re: I have a suggestion.) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin C Calvarese | 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 Re: Ideas for shortening "foreach_reverse" (was Re: I have a suggestion.) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin C Calvarese | "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 |
Copyright © 1999-2021 by the D Language Foundation