How do i perform a check like this?
if {} {
// code if it is collection
} else {
//code for list
}
Do you creatively use sizeof / llength and prevent that from failing? or there's a native command that does this cleanly?
A collection is not standard to Tcl, but is a type of object available in Synopsys design tools.
If you are referring to Synopsys collections, all collection have a string representation like _sel123
or _sel456
. You can check this:
if {[regexp {^_sel\d+$} $obj]} {
# $obj is most likely a collection
} else {
# $obj is something else
}