Re: Petition to chime in Issue 1553 - foreach_reverse is allowed for delegates

2013-10-25 Thread Marco Leise
Am Sun, 20 Oct 2013 15:55:41 +0200
schrieb Peter Alexander peter.alexander...@gmail.com:

 On Sunday, 20 October 2013 at 12:33:27 UTC, bearophile wrote:
  Denis Shelomovskij:
 
  Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=1553
 
  I suggest to keep foreach_reverse in the language, but 
  statically disallow it on delegates.
 
 +1

+1

Often enough I see code that iterates forwards and backwards
over something. foreach and foreach_reverse make the syntax
look the same. I don't like the idea of plugging in
reverse ranges into foreach to get the same effect.

-- 
Marco



Petition to chime in Issue 1553 - foreach_reverse is allowed for delegates

2013-10-20 Thread Denis Shelomovskij
`foreach_reverse` is allowed for delegates and do what `foreach` do thus 
causing dangerous confusion. Walter Bright is the only one for some 
obscure reason definitely for not deprecating this feature and 
WONTFIX-ed the issue. And yes, no big red note in docs about it. As 
always, this is even more error-prone for highly templated language like 
D (i.e. one can expect in template `foreach_reverse` will not compile if 
reverse iteration isn't supported).


Petition for all not indifferent to language misfeatures to chime in and 
show in this thread we all are for deprecating it (if we really are).


Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=1553

Thanks.

--
Денис В. Шеломовский
Denis V. Shelomovskij


Re: Petition to chime in Issue 1553 - foreach_reverse is allowed for delegates

2013-10-20 Thread Denis Shelomovskij

20.10.2013 15:29, Denis Shelomovskij пишет:

`foreach_reverse` is allowed for delegates and do what `foreach` do thus
causing dangerous confusion. Walter Bright is the only one for some
obscure reason definitely for not deprecating this feature and
WONTFIX-ed the issue. And yes, no big red note in docs about it. As
always, this is even more error-prone for highly templated language like
D (i.e. one can expect in template `foreach_reverse` will not compile if
reverse iteration isn't supported).

Petition for all not indifferent to language misfeatures to chime in and
show in this thread we all are for deprecating it (if we really are).

Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=1553

Thanks.


Also the funny thing is according to Andrei [1] about `foreach_reverse` 
over ranges from February 2010:

Gone, that is. Walter agreed to remove it.

[1] http://forum.dlang.org/post/hl8345$2b1q$1...@digitalmars.com

--
Денис В. Шеломовский
Denis V. Shelomovskij


Re: Petition to chime in Issue 1553 - foreach_reverse is allowed for delegates

2013-10-20 Thread bearophile

Denis Shelomovskij:


Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=1553


I suggest to keep foreach_reverse in the language, but statically 
disallow it on delegates.


Bye,
bearophile


Re: Petition to chime in Issue 1553 - foreach_reverse is allowed for delegates

2013-10-20 Thread Dmitry Olshansky

20-Oct-2013 15:29, Denis Shelomovskij пишет:

`foreach_reverse` is allowed for delegates and do what `foreach` do thus
causing dangerous confusion. Walter Bright is the only one for some
obscure reason definitely for not deprecating this feature and
WONTFIX-ed the issue. And yes, no big red note in docs about it. As
always, this is even more error-prone for highly templated language like
D (i.e. one can expect in template `foreach_reverse` will not compile if
reverse iteration isn't supported).

Petition for all not indifferent to language misfeatures to chime in and
show in this thread we all are for deprecating it (if we really are).



+1


At a times it looks as if Walter is in favor of keeping whatever broken 
junk forever just because it was always broken.



Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=1553

Thanks.




--
Dmitry Olshansky


Re: Petition to chime in Issue 1553 - foreach_reverse is allowed for delegates

2013-10-20 Thread Timon Gehr

On 10/20/2013 01:29 PM, Denis Shelomovskij wrote:

`foreach_reverse` is allowed for delegates and do what `foreach` do thus
causing dangerous confusion. Walter Bright is the only one for some
obscure reason definitely for not deprecating this feature and
WONTFIX-ed the issue.  ...


This is by design? I thought it was obviously a bug in the implementation.



Re: Petition to chime in Issue 1553 - foreach_reverse is allowed for delegates

2013-10-20 Thread Peter Alexander

On Sunday, 20 October 2013 at 12:33:27 UTC, bearophile wrote:

Denis Shelomovskij:


Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=1553


I suggest to keep foreach_reverse in the language, but 
statically disallow it on delegates.


+1

foreach_reverse is ugly, but works, and there's no point breaking 
code just to tidy things up a little.


foreach_reverse on delegates on the other hand is completely 
broken, so should be statically disallowed (preferably with a 
nice error message explaining that the current behaviour is 
broken!)




Re: Petition to chime in Issue 1553 - foreach_reverse is allowed for delegates

2013-10-20 Thread Jesse Phillips
On Sunday, 20 October 2013 at 11:29:38 UTC, Denis Shelomovskij 
wrote:
`foreach_reverse` is allowed for delegates and do what 
`foreach` do thus causing dangerous confusion. Walter Bright is 
the only one for some obscure reason definitely for not 
deprecating this feature and WONTFIX-ed the issue. And yes, no 
big red note in docs about it. As always, this is even more 
error-prone for highly templated language like D (i.e. one can 
expect in template `foreach_reverse` will not compile if 
reverse iteration isn't supported).


Petition for all not indifferent to language misfeatures to 
chime in and show in this thread we all are for deprecating it 
(if we really are).


Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=1553

Thanks.


I don't use foreach_reverse and don't intend to. I allowing 
delegates is error prone if it is just going to do what foreach 
does.