Build Status | Test coverage |
---|---|
using InPlace
a = big"1"
b = a
@inplace b += 2
a # is now also equal to 3
This package exposes a single macro, @inplace
, which applies the operation
in its expression argument in-place on the left-hand side (if it is mutable).
Examples:
@inplace a = f(args...)
@inplace a += expr
In the case where a
is mutable, it is an implementation detail whether its
value is actually modified. For this reason, one should use this operation
only on values for which the current stackframe holds the only reference; e.g.
by using deepcopy
.
In this version of the package, it is only the +
,-
(unary and binary) and
*
operations that are done in-place, and only for BigInt
operands.
This package was created for speeding up PolynomialRings.jl
.