Quoting from the TCL man:
"[split] Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will consist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space characters."
Therefore if I'm not mistaken:
[split [self] ::]
will attempt to split self by ':' and ':' rather than '::' which will produce an empty string between each element e.g
set self "mytcl::namespace::isgroovy"
split $self ::
gives a list of 5 elements:
mytcl {} namespace {} isgroovy
rather than a list of three elements:
mytcl namespace isgroovy
I get round this by regsubbing a safe chr inplace of the string then splitting on that chr.
I don't know if that is the desired effects - I'm just poking my nose in.
- Steve