Closed mastrof closed 1 year ago
This problem was mentioned at some point in #846 but maybe it flew past us: even if now I add an exception for the do_checks
, which is no big deal, any ABM defined for ContinuousAgent{D}
will not be concretely typed (while anything inheriting from ContinuousAgent{D}
will be fine).
Do we just highlight this in the update message so people know to use ContinuousAgent{D,Float64}
instead?
yes, we need to revision the do_checks
in my opinion, so that it doesn't error. I think that indeed at some point this didn't error in the PR
The agents you create with ContinuousAgent{D}(...) are concretely typed; but the ABM does not know it in advance. After a local edit to change the checks (will open a PR soon):
julia> ABM(ContinuousAgent{2}, ContinuousSpace((1,1)); warn=false) |> typeof
StandardABM{ContinuousSpace{2, true, Float64, typeof(no_vel_update)}, ContinuousAgent{2}, typeof(fastest), Nothing, TaskLocalRNG} (alias for Agents.SingleContainerABM{ContinuousSpace{2, true, Float64, typeof(Agents.no_vel_update)}, ContinuousAgent{2}, Dict{Int64, ContinuousAgent{2}}, typeof(Agents.Schedulers.fastest), Nothing, Random.TaskLocalRNG})
julia> ABM(ContinuousAgent{2,Float64}, ContinuousSpace((1,1))) |> typeof
StandardABM{ContinuousSpace{2, true, Float64, typeof(no_vel_update)}, ContinuousAgent{2, Float64}, typeof(fastest), Nothing, TaskLocalRNG} (alias for Agents.SingleContainerABM{ContinuousSpace{2, true, Float64, typeof(Agents.no_vel_update)}, ContinuousAgent{2, Float64}, Dict{Int64, ContinuousAgent{2, Float64}}, typeof(Agents.Schedulers.fastest), Nothing, Random.TaskLocalRNG})
On main this now errors:
We had agreed to never use
ContinuousAgent{D}
without specifying the second typeT
, but with the back and forth between different versions and the additional checks on the space type at some point it has slipped through and seems we have broken compatibility for model creation. Now sinceContinuousAgent{2}
is not concrete, we fail the check against the spaceextent
.I guess we should just add an exception to the
do_checks
function