Open kalmarek opened 4 years ago
No worries, heep the issues coming ;)
This is another use case I didn't think of, I'd suggest going for a separate method using StrictlyTypedNumber, as you proposed. Ideally this should also work in the constructor, shouldn't be to difficult to add.
Is it possible to make constructors striclty typed?
However I'd like to channel julia constructor of
Mod.Rational(num::Base.Integer, den::Base.Integer)
throughMod.Integer
(which can handle e.g.Mod.Integer(::BigInt)
correctly), i.e.Mod.Rational(x::Base.Integer, y::Base.Integer) = Mod.Rational(Mod.Integer(BigInt(x)), Mod.Integer(BigInt(y)))
. At the moment I getWARNING: Method definition (::Type{Mod.Rational})(Integer, Integer) in module Mod at /home/kalmar/.julia/packages/CxxWrap/lDNAy/src/CxxWrap.jl:552 overwritten at /home/kalmar/.julia/dev/Mod/src/rationals.jl:4.
Unfortunately I can not add
.constructor<jlcxx::StrictlyTypedNumber<int64_t>, jlcxx::StrictlyTypedNumber<int64_t>>()
asI could create
mod.method("new_rational_si_si", [](jlcxx::StrictlyTypedNumber<int64_t> num, jlcxx::StrictlyTypedNumber<int64_t> den) {return my::Rational(num, den); });
, but maybe there's a better way of doing this?Sorry for the influx of issues.