-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NamedControl 'name' String convertion #4761
Fix NamedControl 'name' String convertion #4761
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see nothing wrong with this. I worried a bit about ctlName
but it really is unused! So, yes, simplify.
I'm just baffled how the IdentityDictionary lookup ever worked before...
Well |
name = name.asString; | ||
if(name[1] == $_) { prefix = name[0]; ctlName = name[2..] } { ctlName = name }; | ||
str = name.asString; | ||
if(str[1] == $_) { prefix = str[0] }; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not removing the prefix from the ctlName might result in some ambiguity. Just make sure to ckeck whether something like \t_trig.kr
and trig.tr
don't interfere in a bad way...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not removing the prefix from the ctlName might result in some ambiguity. Just make sure to ckeck whether something like \t_trig.kr and trig.tr don't interfere in a bad way...
I had the same question, but... in the currently released version, ctlName is assigned in this block and then never used.
Here, there are exactly 3 occurrences of ctlName: once to declare it, and twice in the if
where it's assigned, and then... nothing.
So ctlName is cruft, and deleting the variable entirely is correct.
It's moot because you're fixing it, but...
Dictionary lookup by symbol, ok. Then, if a previously created control is not found:
... where I might be misreading but it does look like this couldn't have worked in the past. But with the fix, it won't be a problem, so it's fine. |
Purpose and Motivation
A NamedControl's
name
is converted from a Symbol to a String in cases where the.init
function is called (whenres == nil
). I stumbled upon this while testing #3814. This issue should be fixed before that PR gets merged.I'm not sure how to demonstrate the issue using current
develop
, but it may be simple enough to understand just by looking at the changes. Some unused variables were removed (ctlName
,ctl
, &selector
), andname
stays a Symbol throughout the.init
function.Types of changes
To-do list