On Thursday, 23 April 2026 at 15:25:35 UTC, H. S. Teoh wrote:
On Thu, Apr 23, 2026 at 03:04:59PM +0000, Dom Disc via Digitalmars-d-learn wrote:
[much too complicated example]
==> cannot implicitly convert expression `pow(cast(int)__powtmp1234,
cast(int)x.val)` of type `int` to `ubyte`

I hate D's policy on integer conversions. That's why I wrote nopromote.d which I posted somewhere in these forums, that lets you attach `.np` (for "no promote") to a short integer somewhere in an expression to "poison" it so that all arithmetic is done without promotion and assignable back to the original variable.
Ah, cool. I'll have a look.

It's *really* b0rken IMO that you cannot even use `^^=` on a short integer! I'd file a bug, but Walter has said that he's not going change his stance on this.

Yeah, you can't use it at all.

ubyte m;
m ^^= m; // doesn't work

So this is a serious bug, not a policy anymore.
  • Operator declara... Dom Disc via Digitalmars-d-learn
    • Re: Operato... H. S. Teoh via Digitalmars-d-learn
    • Re: Operato... Dom Disc via Digitalmars-d-learn
    • Re: Operato... Meta via Digitalmars-d-learn
      • Re: Ope... Dom Disc via Digitalmars-d-learn
      • Re: Ope... Nick Treleaven via Digitalmars-d-learn
        • Re:... Meta via Digitalmars-d-learn
          • ... Dom Disc via Digitalmars-d-learn
          • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... Nick Treleaven via Digitalmars-d-learn
            • ... Meta via Digitalmars-d-learn
              • ... Nick Treleaven via Digitalmars-d-learn

Reply via email to