Worst ideas/features in programming languages?
Basile B.
b2.temp at gmx.com
Mon Nov 15 14:48:36 UTC 2021
On Monday, 15 November 2021 at 14:09:53 UTC, Paul Backus wrote:
> On Monday, 15 November 2021 at 14:02:42 UTC, Imperatorn wrote:
>>
>> What's wrong about retro? Too retro :D
>
> std.range.retro is honestly just a bad name. It should have
> been `reversed`, or maybe `reverser`.
That reverser thing could have been a builtin property e.g
`.reverser`, problem is that the expression that gives a foreach
range
(https://dlang.org/spec/statement.html#foreach-range-statement)
is a bit degenerated for now:
`LwrExpression .. UprExpression`
is actually not an expression at all thus
`(LwrExpression ..UprExpression).reverser`
cant work. But Ideally D could get rid of that `foreach_reverse`
keyword with a property.
```d
foreach (i; (0 .. length).reverser){}
foreach (e; elems.reverser){}
```
Off topic side node : the old [DIP
58](https://wiki.dlang.org/DIP58) shows that the idea to have the
`..` D operator is not new but apparently the case of simplifying
`foreach` was not a goal.
More information about the Digitalmars-d
mailing list