Little in the specman manual would indicate that one can determine on the fly whether a specific variable has been created. (not asking about testing for array index or hash members, which can be done via exists() )
I only noticed that discussion of struct name/path resolution does say that attempting a 'keep' on a struct field that does not exist within the path resolved will result in an error and _must_be_ commented out...
My work involves simulating a model constantly updated by multiple e-code developers, and test benches lose backwards compatibility whenever someone simply creates a new variable to further specify model & TCM build parameters.
You can do this with the reflection interface. Look up "rf_manager" in the docs. Not everything is documented, however...
Here, I'm testing for the existence of field
baz
:This yields
If you need to iterate over the fields, do :