opConcatAll?
Ben Jones
fake at fake.fake
Fri Jul 3 18:39:53 UTC 2020
On Friday, 3 July 2020 at 18:07:08 UTC, Steven Schveighoffer
wrote:
> That's what's already done today.
>
> The idea here is to pass all the operations and parameters at
> once. There are actually advantages in some cases to have the
> entire expression, as some things could be optimized by
> reordering operations (in a valid way).
>
> The further question of this subthread is -- can we loosen some
> of the precedence rules so this provides more capabilities, or
> would it be crippled by enforcing precedence rules?
>
> -Steve
I think grouping all operations with the same precedence using
your new nAryOp idea is a good compromise. If you need to mess
with precedence rules, then you can write expression templates to
do so.
I imagine the most common case is string concatenation with a
bunch of strings which that approach would handle.
Example:
a + b - c*d/e would become
a.opNaray!(["+", "-"])(a, b, c.opNary!(["*", "/"])(c, d, e))
More information about the Digitalmars-d
mailing list