So I thought I would fix that Gmp.mpz(3)%2 has the type mixed. My
first quick and dirty fix was to update the type of `% a bit by adding

  tFunc(tObjIs_GMP_MPZ tInt, tObjIs_GMP_MPZ)

Yes, it ignores the int%mpz and mpz%mpz permutations, but it's a
start. Not the right one apparently, as I got the following
warning when trying it out on Crypto.Random.

The code

Gmp.mpz random(int top) {
  return Gmp.mpz(rnd_func( (int)ceil(Math.log2(top)) ), 256) % top;
}

generates

Warning: Wong return type.
Warning: Expected: { mpz = object(implements _static_modules.Gmp()->mpz) }.
Warning: Got     : object(is _static_modules.Gmp()->mpz) | mixed.

Why is there a "| mixed" in this type?
Is this at all the correct approach?
Can we get nicer names than _static_modules.Gmp()->mpz?
  • The type of... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum
    • The ty... Henrik Grubbström (Lysator) @ Pike (-) developers forum
      • Th... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum
        • ... Henrik Grubbström (Lysator) @ Pike (-) developers forum
          • ... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum

Reply via email to