digitalmars.D - Pow Expressions - not worth the juice?
- Walter Bright (4/4) Feb 02 https://dlang.org/spec/expression.html#pow_expressions
- Richard (Rikki) Andrew Cattermole (4/10) Feb 02 Absolutely not, the implementation can be moved to based as soon as we
- jmh530 (3/13) Feb 02 based? bundles solving binaries? Not sure on what these are...
- Richard (Rikki) Andrew Cattermole (10/26) Feb 02 Based is part of PhobosV3 work, and lives "under" druntime.
- monkyyy (4/8) Feb 02 clearly the solution is to let users define opOverloads anywhere
- Dukc (11/15) Feb 02 No. It's established syntax, please do not break it. It's also
- Sergey (3/7) Feb 02 Can we instead of continuous breaking freeze for another 6 months
- Sam Potter (6/10) Feb 02 Please no.
- Lance Bachmeier (2/14) Feb 02 We should have more operators, not fewer.
- jmh530 (29/47) Feb 03 I have found that R’s custom infix operators are nice [1]. They
- user1234 (5/33) Feb 03 So you just avoid the call-expression syntax so that you can put
- user1234 (3/7) Feb 03 I must add: this brings the topic of defining global operator
- Walter Bright (4/6) Feb 03 This feature is not in D because it leads to impenetrable code. One terr...
- monkyyy (9/16) Feb 03 No, it *enables* impenetrable code; `2^^3` is not impenetrable
- Sam Potter (24/31) Feb 04 I had a very interesting experience using D for the
- jmh530 (7/37) Feb 03 I was sketching out what a D version of the example from that
- user1234 (6/21) Feb 03 Thanks for your reply but that confirms what I initially thought.
- user1234 (3/10) Feb 03 well to be completly honest, it's nice to be able to write `a %∩%
- jmh530 (2/13) Feb 03 Walter would never go for unlimited overloading.
- user1234 (6/21) Feb 03 I would not either, for the simple reason that you would have to
- Walter Bright (6/7) Feb 03 Once that gate to hell is opened, we'll never be able to close it.
- Lance Bachmeier (3/11) Feb 03 If you think that's bad, wait until you see the ugly mess that
- Walter Bright (3/5) Feb 03 I did try to reduce the incidence of awfulness with templates with a (mu...
- Dejan Lekic (7/18) Feb 03 I suppose you could use # for this purpose and make `10
- Lance Bachmeier (5/11) Feb 03 R didn't have many alternatives, as it's a numerical language, so
- Sergey (6/10) Feb 03 This feature is not very often used.
- Lance Bachmeier (7/56) Feb 03 An important decision they made is that you can have custom
- Walter Bright (5/7) Feb 03 In D that would be like:
- Richard (Rikki) Andrew Cattermole (8/16) Feb 03 "op" there isn't meant to be a valid identifier.
- user1234 (7/24) Feb 03 I see indeed a lot of potential disapoinment.
- Richard (Rikki) Andrew Cattermole (4/34) Feb 03 Identifiers have nothing to do with this, its a mathematical operator
- Sergey (7/11) Feb 03 Julia supports it :)
- jmh530 (9/21) Feb 03 which places limits on what "op" can be. That's why I elsewhere
- Timon Gehr (15/22) Feb 02 No. An actual example of an oddball "feature" is how D handles closure
- Timon Gehr (2/8) Feb 02 As Adam points out: https://github.com/dlang/dmd/pull/14297
- Walter Bright (2/5) Feb 03 Putting it in druntime is a reasonable way to go.
- H. S. Teoh (7/13) Feb 03 No, please don't. Being able to write x^^y instead of ugliness like
https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?
Feb 02
On 03/02/2026 6:43 AM, Walter Bright wrote:https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?Absolutely not, the implementation can be moved to based as soon as we have something like bundles solving binaries. This is precisely what based is meant to be able to solve.
Feb 02
On Monday, 2 February 2026 at 17:48:20 UTC, Richard (Rikki) Andrew Cattermole wrote:On 03/02/2026 6:43 AM, Walter Bright wrote:based? bundles solving binaries? Not sure on what these are...https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?Absolutely not, the implementation can be moved to based as soon as we have something like bundles solving binaries. This is precisely what based is meant to be able to solve.
Feb 02
On 03/02/2026 9:52 AM, jmh530 wrote:On Monday, 2 February 2026 at 17:48:20 UTC, Richard (Rikki) Andrew Cattermole wrote:Based is part of PhobosV3 work, and lives "under" druntime. For all intents and purposes its a library that will always exist if you have D, and will provide things like atomics and bit manipulation. Bundles is an approach to software/source code distribution, its used on osx. Right now we use a very hard coded approach, that doesn't support based or PhobosV3. If you're not contributing to druntime or compiler you can basically ignore it.On 03/02/2026 6:43 AM, Walter Bright wrote:based? bundles solving binaries? Not sure on what these are...https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?Absolutely not, the implementation can be moved to based as soon as we have something like bundles solving binaries. This is precisely what based is meant to be able to solve.
Feb 02
On Monday, 2 February 2026 at 17:43:45 UTC, Walter Bright wrote:https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?clearly the solution is to let users define opOverloads anywhere and then properly define it as `auto opBinary(string op:"^^",T,S)(T t,S s)`
Feb 02
On Monday, 2 February 2026 at 17:43:45 UTC, Walter Bright wrote:https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?No. It's established syntax, please do not break it. It's also handy, I sure prefer `a^^b` to `pow(a, b)` and slightly even over `a.pow(b)`. However, there is a case for having power expressions to rewrite to a DRuntime symbol instead, even if that symbol then aliases to an `extern` function that is implemented in Phobos. Users should be able to override that DRuntime symbol, and it should be implemented so it only links to Phobos if the default DRuntime symbol is actually used - probably means the symbol should be a templated.
Feb 02
On Monday, 2 February 2026 at 17:43:45 UTC, Walter Bright wrote:https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?Can we instead of continuous breaking freeze for another 6 months and fix all regressions that recent releases provided?
Feb 02
On Monday, 2 February 2026 at 17:43:45 UTC, Walter Bright wrote:https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?Please no. Operator overloading for ^^ is a really nice quality of life improvement for numerical and scientific programming. All five major numerical programming languages support this: MATLAB, Python, Fortran, Julia, and R.
Feb 02
On Monday, 2 February 2026 at 20:23:01 UTC, Sam Potter wrote:On Monday, 2 February 2026 at 17:43:45 UTC, Walter Bright wrote:We should have more operators, not fewer.https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?Please no. Operator overloading for ^^ is a really nice quality of life improvement for numerical and scientific programming. All five major numerical programming languages support this: MATLAB, Python, Fortran, Julia, and R.
Feb 02
On Tuesday, 3 February 2026 at 01:38:03 UTC, Lance Bachmeier wrote:On Monday, 2 February 2026 at 20:23:01 UTC, Sam Potter wrote:I have found that R’s custom infix operators are nice [1]. They have a good balance between allowing library writers to be expressible, as well as a bit of a warning that "here be dragons". For those not familiar, putting an R example into a D context it would mean you could do something like ``` struct Foo double x; bool opBinary(string op)(double y) if (op == "%divisible%") { return x % y == 0 ? true : false; } } ``` where the basically the `"op"` can be anything so long as it is delimited in a form like "%op%" It would be even better if you could do something like (to my knowledge `opBinary` would need to be a member function). ``` bool opBinary(string op)(double x, double y) if (op == "%divisible%") { return x % y == 0 ? true : false; } ``` [1] https://www.datamentor.io/r-programming/infix-operatorOn Monday, 2 February 2026 at 17:43:45 UTC, Walter Bright wrote:We should have more operators, not fewer.https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?Please no. Operator overloading for ^^ is a really nice quality of life improvement for numerical and scientific programming. All five major numerical programming languages support this: MATLAB, Python, Fortran, Julia, and R.
Feb 03
On Tuesday, 3 February 2026 at 15:11:17 UTC, jmh530 wrote:
I have found that R’s custom infix operators are nice [1]. They
have a good balance between allowing library writers to be
expressible, as well as a bit of a warning that "here be
dragons".
For those not familiar, putting an R example into a D context
it would mean you could do something like
```
struct Foo
double x;
bool opBinary(string op)(double y)
if (op == "%divisible%")
{
return x % y == 0 ? true : false;
}
}
```
where the basically the `"op"` can be anything so long as it is
delimited in a form like "%op%"
It would be even better if you could do something like (to my
knowledge `opBinary` would need to be a member function).
```
bool opBinary(string op)(double x, double y)
if (op == "%divisible%")
{
return x % y == 0 ? true : false;
}
```
[1] https://www.datamentor.io/r-programming/infix-operator
So you just avoid the call-expression syntax so that you can put
spaces between the operands and the operator ? I'm not sure this
solves any problem. Maybe you can provide enlightning examples ?
The one from your link is not convincing.
Feb 03
On Tuesday, 3 February 2026 at 15:23:09 UTC, user1234 wrote:So you just avoid the call-expression syntax so that you can put spaces between the operands and the operator ? I'm not sure this solves any problem. Maybe you can provide enlightning examples ? The one from your link is not convincing.I must add: this brings the topic of defining global operator overloads as well. A very old topic in D NG.
Feb 03
On 2/3/2026 7:24 AM, user1234 wrote:I must add: this brings the topic of defining global operator overloads as well. A very old topic in D NG.This feature is not in D because it leads to impenetrable code. One terrifying example of this is overloading operators such that what looks like ordinary code is actually a regular expression machine.
Feb 03
On Tuesday, 3 February 2026 at 17:50:12 UTC, Walter Bright wrote:On 2/3/2026 7:24 AM, user1234 wrote:No, it *enables* impenetrable code; `2^^3` is not impenetrable and as you see you instantly got 4 pages of backlash for suggesting its removal. I hate when you break your own rules for your special cases; you needed to define an op overload via magic lib, but because your the compiler dev you let yourself do it. Do the opposite of what your getting backlash here for, *I want that tool*, that will bring consistency your looking for.I must add: this brings the topic of defining global operator overloads as well. A very old topic in D NG.This feature is not in D because it leads to impenetrable code. One terrifying example of this is overloading operators such that what looks like ordinary code is actually a regular expression machine.
Feb 03
On Tuesday, 3 February 2026 at 17:50:12 UTC, Walter Bright wrote:On 2/3/2026 7:24 AM, user1234 wrote:I had a very interesting experience using D for the implementation of a math library earlier last year. Because of D's import rules, I quickly realized that if I wanted to have a generic "operator" like `pow` or `intersect` or `abs` or whatever else, what actually made the most sense was to have a separate file (e.g. "pow.d") where all the `pow` overloads lived. That way, if I wanted to use `pow`, the prescription was simple: `import pow;`. All of the issues with precedence between imports that crop up when you have `pow` littered all over the place simply evaporated. I've since had to rewrite this library in C++ :( :( but I kept this organizational choice and have had close to 0 compilation errors that originated from ADL weirdness. Well, you can see where I'm going with this... `^^` is just notation for `pow`... Having to define operators *in* a class didn't prevent me from doing anything, but if I had been able to define them in `opPow.d` (or whatever), I think the design of my library would have been even clearer and more rational. FWIW, in a math library, overloads of `pow` are myriad: are you raising an integer to an integer? No, a matrix to a matrix? Oh... a diagonal matrix raised to an arbitrary precision rational number... Or maybe a polynomial in the Bernstein basis raised to a polynomial in the monomial basis...I must add: this brings the topic of defining global operator overloads as well. A very old topic in D NG.This feature is not in D because it leads to impenetrable code. One terrifying example of this is overloading operators such that what looks like ordinary code is actually a regular expression machine.
Feb 04
On Tuesday, 3 February 2026 at 15:23:09 UTC, user1234 wrote:[snip]I was sketching out what a D version of the example from that link, not that I would want to do that in D. We have UFCS. The idea is that you can put anything in within the "op" of "%op%", so it's on the user to decide how they want to make use of it (or not). R uses "%*%" for matrix multiplication. That's more ergonomic than `A.matmul(B)`.``` struct Foo double x; bool opBinary(string op)(double y) if (op == "%divisible%") { return x % y == 0 ? true : false; } } ``` where the basically the `"op"` can be anything so long as it is delimited in a form like "%op%" It would be even better if you could do something like (to my knowledge `opBinary` would need to be a member function). ``` bool opBinary(string op)(double x, double y) if (op == "%divisible%") { return x % y == 0 ? true : false; } ``` [1] https://www.datamentor.io/r-programming/infix-operatorSo you just avoid the call-expression syntax so that you can put spaces between the operands and the operator ? I'm not sure this solves any problem. Maybe you can provide enlightning examples ? The one from your link is not convincing.
Feb 03
On Tuesday, 3 February 2026 at 15:51:05 UTC, jmh530 wrote:On Tuesday, 3 February 2026 at 15:23:09 UTC, user1234 wrote:Thanks for your reply but that confirms what I initially thought. Personally I see a little problem with the surrouding percent symbols (i.e not a progress compared to call syntax, they are equally unperfect) but essentially that's not a criticism about R designers choices. Just not fan you see.[snip]I was sketching out what a D version of the example from that link, not that I would want to do that in D. We have UFCS. The idea is that you can put anything in within the "op" of "%op%", so it's on the user to decide how they want to make use of it (or not). R uses "%*%" for matrix multiplication. That's more ergonomic than `A.matmul(B)`.[...]So you just avoid the call-expression syntax so that you can put spaces between the operands and the operator ? I'm not sure this solves any problem. Maybe you can provide enlightning examples ? The one from your link is not convincing.
Feb 03
On Tuesday, 3 February 2026 at 16:39:59 UTC, user1234 wrote:On Tuesday, 3 February 2026 at 15:51:05 UTC, jmh530 wrote:well to be completly honest, it's nice to be able to write `a %∩% b` but the percent syms waste the whole thing I think.[...]Thanks for your reply but that confirms what I initially thought. Personally I see a little problem with the surrouding percent symbols (i.e not a progress compared to call syntax, they are equally unperfect) but essentially that's not a criticism about R designers choices. Just not fan you see.
Feb 03
On Tuesday, 3 February 2026 at 17:10:13 UTC, user1234 wrote:On Tuesday, 3 February 2026 at 16:39:59 UTC, user1234 wrote:Walter would never go for unlimited overloading.On Tuesday, 3 February 2026 at 15:51:05 UTC, jmh530 wrote:well to be completly honest, it's nice to be able to write `a %∩% b` but the percent syms waste the whole thing I think.[...]Thanks for your reply but that confirms what I initially thought. Personally I see a little problem with the surrouding percent symbols (i.e not a progress compared to call syntax, they are equally unperfect) but essentially that's not a criticism about R designers choices. Just not fan you see.
Feb 03
On Tuesday, 3 February 2026 at 17:25:10 UTC, jmh530 wrote:On Tuesday, 3 February 2026 at 17:10:13 UTC, user1234 wrote:I would not either, for the simple reason that you would have to run the sema of every import known. That breaks a bit the "adhoc" compilation model. This would add complexity. For now this is simple. Custom type ? let's see if that custom type implements the opover. dead simple.On Tuesday, 3 February 2026 at 16:39:59 UTC, user1234 wrote:Walter would never go for unlimited overloading.On Tuesday, 3 February 2026 at 15:51:05 UTC, jmh530 wrote:well to be completly honest, it's nice to be able to write `a %∩% b` but the percent syms waste the whole thing I think.[...]Thanks for your reply but that confirms what I initially thought. Personally I see a little problem with the surrouding percent symbols (i.e not a progress compared to call syntax, they are equally unperfect) but essentially that's not a criticism about R designers choices. Just not fan you see.
Feb 03
On 2/3/2026 9:25 AM, jmh530 wrote:Walter would never go for unlimited overloading.Once that gate to hell is opened, we'll never be able to close it. Just like with macros. The current operator overloading feature is carefully designed to prevent general operator overloading. For example, < <= > >= cannot be individually overloaded.
Feb 03
On Tuesday, 3 February 2026 at 18:05:11 UTC, Walter Bright wrote:On 2/3/2026 9:25 AM, jmh530 wrote:If you think that's bad, wait until you see the ugly mess that can be made with pointers, metaprogramming, and templates.Walter would never go for unlimited overloading.Once that gate to hell is opened, we'll never be able to close it. Just like with macros. The current operator overloading feature is carefully designed to prevent general operator overloading. For example, < <= > >= cannot be individually overloaded.
Feb 03
On 2/3/2026 11:38 AM, Lance Bachmeier wrote:If you think that's bad, wait until you see the ugly mess that can be made with pointers, metaprogramming, and templates.I did try to reduce the incidence of awfulness with templates with a (much) cleaner design than C++, but still templates are overused.
Feb 03
On Tuesday, 3 February 2026 at 17:10:13 UTC, user1234 wrote:On Tuesday, 3 February 2026 at 16:39:59 UTC, user1234 wrote:#divisible anywhere in D. How can people live with that terrible R syntax is beyond me, but hey - matter of taste I guess! This could allow alternative syntax for some common logic operators (`foo #ge as alternative to `foo >= 2`)...On Tuesday, 3 February 2026 at 15:51:05 UTC, jmh530 wrote:well to be completly honest, it's nice to be able to write `a %∩% b` but the percent syms waste the whole thing I think.[...]Thanks for your reply but that confirms what I initially thought. Personally I see a little problem with the surrouding percent symbols (i.e not a progress compared to call syntax, they are equally unperfect) but essentially that's not a criticism about R designers choices. Just not fan you see.
Feb 03
On Tuesday, 3 February 2026 at 17:29:44 UTC, Dejan Lekic wrote:#divisible anywhere in D. How can people live with that terrible R syntax is beyond me, but hey - matter of taste I guess! This could allow alternative syntax for some common logic operators (`foo #geR didn't have many alternatives, as it's a numerical language, so they already used all the operators for other things. It does make it stand out, which is nice for readability once you are experienced with the language.
Feb 03
On Tuesday, 3 February 2026 at 17:29:44 UTC, Dejan Lekic wrote:How can people live with that terrible R syntax is beyond me, but hey - matter of taste I guess! This could allow alternative syntax for some common logic operators (`foo #ge alternative to `foo >= 2`)...This feature is not very often used. I could remember only `%>%` which was moved to `|>` in newer versions. And `%in%` which you could use as `if (x %in% c("foo", "bar")` But R is pretty specific because of its roots with S and Lisp =)
Feb 03
On Tuesday, 3 February 2026 at 15:11:17 UTC, jmh530 wrote:On Tuesday, 3 February 2026 at 01:38:03 UTC, Lance Bachmeier wrote:An important decision they made is that you can have custom operators, but you can't change the precedence.[1] You can add parens to your code if you want to customize precedence. There are really no downsides to custom operators. [1] https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Infix-and-prefix-operatorsOn Monday, 2 February 2026 at 20:23:01 UTC, Sam Potter wrote:I have found that R’s custom infix operators are nice [1]. They have a good balance between allowing library writers to be expressible, as well as a bit of a warning that "here be dragons". For those not familiar, putting an R example into a D context it would mean you could do something like ``` struct Foo double x; bool opBinary(string op)(double y) if (op == "%divisible%") { return x % y == 0 ? true : false; } } ``` where the basically the `"op"` can be anything so long as it is delimited in a form like "%op%" It would be even better if you could do something like (to my knowledge `opBinary` would need to be a member function). ``` bool opBinary(string op)(double x, double y) if (op == "%divisible%") { return x % y == 0 ? true : false; } ``` [1] https://www.datamentor.io/r-programming/infix-operatorOn Monday, 2 February 2026 at 17:43:45 UTC, Walter Bright wrote:We should have more operators, not fewer.https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?Please no. Operator overloading for ^^ is a really nice quality of life improvement for numerical and scientific programming. All five major numerical programming languages support this: MATLAB, Python, Fortran, Julia, and R.
Feb 03
On 2/3/2026 7:11 AM, jmh530 wrote:where the basically the `"op"` can be anything so long as it is delimited in a form like "%op%"In D that would be like: ```d x.op(y) ```
Feb 03
On 04/02/2026 6:46 AM, Walter Bright wrote:On 2/3/2026 7:11 AM, jmh530 wrote:"op" there isn't meant to be a valid identifier. It would translate to: ``a.opBinary!"op"(b)`` or ``a.opUnary!"op"`` I don't like this delineated approach, but there are tables for Unicode math binary/unary op's around. Main issue is a character can be both. However given D is not a mathematical language, its introduction is questionable at best.where the basically the `"op"` can be anything so long as it is delimited in a form like "%op%"In D that would be like: ```d x.op(y) ```
Feb 03
On Tuesday, 3 February 2026 at 18:34:01 UTC, Richard (Rikki) Andrew Cattermole wrote:On 04/02/2026 6:46 AM, Walter Bright wrote:I see indeed a lot of potential disapoinment. people wants to be able to write `a ∩ b`. But `∩` is not an regulatory identifier character (I remember you've recently worked on that problem). The R lang solution would not even work. `a "∩" b` or something... just like the workaround in R.On 2/3/2026 7:11 AM, jmh530 wrote:"op" there isn't meant to be a valid identifier. It would translate to: ``a.opBinary!"op"(b)`` or ``a.opUnary!"op"`` I don't like this delineated approach, but there are tables for Unicode math binary/unary op's around. Main issue is a character can be both. However given D is not a mathematical language, its introduction is questionable at best.where the basically the `"op"` can be anything so long as it is delimited in a form like "%op%"In D that would be like: ```d x.op(y) ```
Feb 03
On 04/02/2026 7:55 AM, user1234 wrote:On Tuesday, 3 February 2026 at 18:34:01 UTC, Richard (Rikki) Andrew Cattermole wrote:Identifiers have nothing to do with this, its a mathematical operator just like ``|`` is. Different set of tables (in this case hard coded into parser).On 04/02/2026 6:46 AM, Walter Bright wrote:I see indeed a lot of potential disapoinment. people wants to be able to write `a ∩ b`. But `∩` is not an regulatory identifier character (I remember you've recently worked on that problem). The R lang solution would not even work. `a "∩" b` or something... just like the workaround in R.On 2/3/2026 7:11 AM, jmh530 wrote:"op" there isn't meant to be a valid identifier. It would translate to: ``a.opBinary!"op"(b)`` or ``a.opUnary!"op"`` I don't like this delineated approach, but there are tables for Unicode math binary/unary op's around. Main issue is a character can be both. However given D is not a mathematical language, its introduction is questionable at best.where the basically the `"op"` can be anything so long as it is delimited in a form like "%op%"In D that would be like: ```d x.op(y) ```
Feb 03
On Tuesday, 3 February 2026 at 18:55:42 UTC, user1234 wrote:people wants to be able to write `a ∩ b`. But `∩` is not an regulatory identifier character (I remember you've recently worked on that problem). The R lang solution would not even work. `a "∩" b` or something... just like the workaround in R.Julia supports it :) ```julia a = Set([1,2,3]) b = Set([3,4,5]) c = a ∩ b ```
Feb 03
On Tuesday, 3 February 2026 at 17:46:40 UTC, Walter Bright wrote:On 2/3/2026 7:11 AM, jmh530 wrote:According to D grammar [1]:where the basically the `"op"` can be anything so long as it is delimited in a form like "%op%"In D that would be like: ```d x.op(y) ```Identifiers start with a letter, _, or universal alpha, and are followed by any number of letters, _, digits, or universal alphas. Universal alphas are as defined in ISO/IEC 9899:1999(E) Appendix D of the C99 Standard.which places limits on what "op" can be. That's why I elsewhere said that you would write something like `x.matmul(y)` in D whereas in R you would write `x %*% y` (Matlab's even more convenient with `x * y`, but they use `x .* y` for element-wise multiplication, which I like but deviates too much from C for D to adopt I think). [1] https://dlang.org/spec/lex.html#Identifier
Feb 03
On 2/2/26 18:43, Walter Bright wrote:https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D,No. An actual example of an oddball "feature" is how D handles closure allocation in loops in that its implementation and resulting behavior is completely and utterly broken in a way that goes way below and beyond even the plethora of slightly different bad designs that exist in other popular languages.in that it's the only feature that relies on Phobos for its implementation. ...Well, then maybe the implementation should be changed.Time for it to go?Absolutely not. I suggest focusing attention on actual problems instead of continuously trying to break obvious quality-of-life features that together add up to making D great. Binary literals and opBinary!"^^" ftw. I know it's much trickier to fix hard problems instead of gratuitously breaking simple things that already work, but I really think that's just also where most of the juice is.
Feb 02
On 2/3/26 00:23, Timon Gehr wrote:As Adam points out: https://github.com/dlang/dmd/pull/14297in that it's the only feature that relies on Phobos for its implementation. ...Well, then maybe the implementation should be changed.
Feb 02
On 2/2/2026 3:43 PM, Timon Gehr wrote:Putting it in druntime is a reasonable way to go.Well, then maybe the implementation should be changed.As Adam points out: https://github.com/dlang/dmd/pull/14297
Feb 03
On Mon, Feb 02, 2026 at 09:43:45AM -0800, Walter Bright via Digitalmars-d wrote:https://dlang.org/spec/expression.html#pow_expressions They're a bit of an oddball feature in D, in that it's the only feature that relies on Phobos for its implementation. Time for it to go?No, please don't. Being able to write x^^y instead of ugliness like pow(x,y) that you have to in other languages is a very nice QoL feature in D. Why are we trying to make D harder to use, instead of easier? T -- People tell me that I'm paranoid, but they're just out to get me.
Feb 03









"Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> 