Discussion Thread: DIP 1037--Add Unary Operator ...--Community Review Round 1
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Wed Oct 28 14:56:10 UTC 2020
On Wednesday, 28 October 2020 at 14:48:48 UTC, Manu wrote:
> Definitely not my DIP. I can immediately imagine heaps of
> issues with that
> idea, and I have never wanted that before.
> If you want to do a non-static map, then use `map`, which
> accepts a lambda
> and looks and feels very natural and convenient.
Make the syntax uniform. Don't continue with special cases...
> Not sure what this means? You can slice tuples in D, does that
> not give you the ability to offset as you like?
That was an example. Reverse. Every other etc.
> I don't think this is necessary, and it is deliberately omitted.
That is a serious omission. Fold needs an initial value in order
to be generic.
>> IN:
>> (seq1[_]*10 + seq2[_+1], ...)
>>
>> OUT (e.g. length = min(seq1.length, seq2.length):
>> (seq1[0]*10 + seq2[1], seq1[1]*10 + seq2[2], seq1[2]*10 +
>> seq2[3])
>
>
> That looks like a minefield of grammatical issues.
No, it isn't. D uses a recursive descent parser and it will
evaluate the first expression to an expression with a special
token. Trivial extension of the parser.
> Why would you prefer that with the comma separating the
> expression and `...`?
Because what you proposed is not intuitive:
"(seq1)..."
does not give any hint of it being expanded to a comma separated
list. That is not good from a usability point of view
(legibility).
More information about the Digitalmars-d
mailing list