Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit type conversion for parameters don't work #19

Open
mchitre opened this issue Mar 23, 2022 · 0 comments
Open

Implicit type conversion for parameters don't work #19

mchitre opened this issue Mar 23, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@mchitre
Copy link
Member

mchitre commented Mar 23, 2022

Example:

Agent:

@agent struct Physical <: Agent
  propagationSpeed::Float64 = 1500
end

Fjage.params(::Physical) = [
  "org.arl.unet.phy.PhysicalParam.propagationSpeed" => :propagationSpeed
]

results in:

> phy.propagationSpeed
1500
> phy.propagationSpeed = 330   # should work, but fails
WARNING: Parameter propagationSpeed set to 1500
> phy.propagationSpeed = 330.0
330.0

The second one fails because:

julia> setfield!(a, :propagationSpeed, 330)
ERROR: TypeError: in setfield!, expected Float64, got a value of type Int64
Stacktrace:
 [1] top-level scope
   @ REPL[9]:1

julia> setfield!(a, :propagationSpeed, 330.0)
330.0
@mchitre mchitre added the bug Something isn't working label Mar 23, 2022
@mchitre mchitre self-assigned this Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant