Skip to content

Bug - invalid attribute access error when missing a state handler #322

@GondekNP

Description

@GondekNP

Related to #321 - if we start in a state that doesn't have a valid state handler (as in below, we have no seedling handler), we get an Unable to get value for ValueResolver(Trees.age). While I wouldn't expect the below to be interesting, I would expect it to run and contain only seedlings, however it throws Unable to get value for ValueResolver(Trees.age).

start organism Tree

  age.init = 0 count
  age.step = prior.age + 1 count

  maturity.init = 0 count
  # NO default maturity.step handler!

  # Start in "seedling" - but maturity has no handler for seedling!
  state.init = "seedling"
  # Stay in seedling forever (no transition)
  state.step = "seedling"

  inSeedling.init = 1 count
  inSeedling.step
    :if(current.state == "seedling") = 1 count
    :else = 0 count

  # Handlers only exist for juvenile and adult - NOT seedling
  start state "juvenile"
    maturity.step = current.age / 10 count
  end state

  start state "adult"
    maturity.step = 1 count
  end state

end organism

Intuitively I think this should maybe throw a warning, but you could also imagine plenty of situations where the user want the initial state to be vanilla and do nothing interesting (changing state by some patch-level or unconditional organism logic for eg), then having stateful behaviors trigger once they get to some state. In either case I would expect to run properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions