When do fields have reference semantics and when do they have value semantics?
According to the standard, actors, structs, actions, and scenarios are structured types. Furthermore,
Fields represent data members inside structured types. Each field has a defined type. When instantiating a structured type, each field holds an instance of its respective type. A field can be defined as a parameter or a variable. Methods describe and implement the behavior of an object, which is an instantiation of a class. Fields, methods, and events are named and must have a unique name within the type.
Hence, if a scenario type has two fields of type vehicle, then the scenario instance ("the scenario that is executed") holds two vehicle instances, and two vehicles exist inside the simulation. These are not references to a single vehicle.
However, many structured types within the domain model refer to actors, instead of instantiating them. For example, the associated actor of actions or scenarios is an implicit field:
This actor is called the associated actor and can be interpreted as the actor performing the behavior described in the scenario. However, within a scenario, the actor field and other parameter fields can be used in the same way.
Other examples are the 'reference: physical_object' field of 'action vehicle.change_lane', or the 'bm_engine: bm_engine' field of 'struct behavioral model' (a comment in standard.osc names it a "reference to the "behavioral model engine.""
As the section Relational operators over non-numeric expressions indicates, names of parameters of structured types behave as references inside of expressions.
- When are structured types instantiated?
A possible interpretation is that the scenario instance and, recursively, its structured type fields are instances. Furthermore, the global parameters of structured types instantiate these structured types.
- When are names of structured types references?
A possible interpretation is that any behavior invocation and method call binds the names as references to the instances, but do not instantiate any structured types. This would conflict with 'bm_engine' being a reference as mentioned above, but this comment may use the word reference outside of the language scope anyway. Additionally, any names of structured types inside expressions are references.
This should probably be clarified by the standard. Do my interpretations make sense? Is this exhaustive, or are there other places where structured types occur?