compat: move is_new and is_old option methods to metatable
The is_new and is_old methods are the same for all compat options so they should be defined in a metatable. A good thing about this change is that it removes is_new and is_old from serialization: * Before: NO_WRAP tarantool> require('compat').yaml_pretty_multiline --- - is_new: 'function: 0x4175d6e8' is_old: 'function: 0x4175d790' brief: | Whether to encode in block scalar style all multiline strings or ones containing "\n\n" substring. The new behavior makes all multiline string output as single text block which is handier for the reader, but may be incompatible with some existing applications that rely on the old style. https://tarantool.io/compat/yaml_pretty_multiline current: default default: new ... NO_WRAP * After: NO_WRAP tarantool> require('compat').yaml_pretty_multiline --- - current: default brief: | Whether to encode in block scalar style all multiline strings or ones containing "\n\n" substring. The new behavior makes all multiline string output as single text block which is handier for the reader, but may be incompatible with some existing applications that rely on the old style. https://tarantool.io/compat/yaml_pretty_multiline default: new ... NO_WRAP To achieve that, we have to remove the option name from the usage error message but it seems to be okay because such errors shouldn't happen in practice and the error message is clear enough to figure out what went wrong. Follow-up #8807 NO_DOC=refactoring NO_CHANGELOG=refactoring (cherry picked from commit 75b5fd05)
Please register or sign in to comment