Whatever version is chosen I think it’ll take quite some time for extensions to support immutable strings. I think it would be wise to have the next SU version warn every time a string is modified, but allow it, to give developers time to adapt.
I ran a portion of the tests (the ‘ruby’ folder), and with ‘frozen strings’ set as a start up option, there were thirteen errors. There would probably be more if I ran the whole suite. Hence, Ruby trunk can’t freeze strings and have its own test suite pass.
Importantly, a quick look at the errors showed that they were caused by the test code, not base Ruby code. Said another way, to pass, changes are required only in the test code.
Hence, Ruby will not be setting frozen strings as the default for a few versions, probably not until Ruby 3. Trimble could set it, but that’s unlikely.
Regardless, portions of Ruby and many external libraries/gems are using # frozen_string_literal: true. Some are setting it as a startup option in their CI testing.
I would suggest that plugin authors start testing their code with it enabled via the comment. In some situations, it may result in increased speed or lower memory use…
I think it is planned for version 3 but be gradually phased in. First it is optional (2.3) but if I understand it correctly it is planned to be compulsorily in the end. Maybe it is good to get to where it is optional as soon as possible to give the community time to adapt our code before it is made compulsory.
To all, I apologize for some incorrect statements in this thread. I stated
With current versions of SketchUp, that functionality is not available. I am not using an alpha or beta version of SketchUp, but I am using a ‘non-standard’ version that I created.
It is the default version that loads, and it’s the only version on my Windows start menu and taskbar. Similarly, the default version of stand-alone Ruby that I use is a current version of trunk.
Hence, I sometimes forget that I am not using the standard versions…
As @eneroth3 correctly stated, the ‘frozen-string’ comment can only be used with Ruby versions 2.3 and later.