You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am working on localization of some scripts using new localization tools I am developing. Specifically, I would like to localize the transposition scripts as a pilot project for other scripts in the repo. But these scripts still work with JW Lua. I would like to find an elegant solution for skipping the new method calls in RGP Lua so that the scripts can continue to work with JW Lua.
Describe the solution you'd like
It occurred to me that mixin might be able to provide default implementations of missing methods. What I have in mind is that any method call could provide an optional additional parameter. If the additional parameter were present (non nil), the mixin library would check for the existence of the underlying RGP Lua method. If not found, it would return either return the default value passed in or (if the method is fluid) ignore the call entirely and simply return self. (If found it would call the method and behave as it does now.)
Describe alternatives you've considered
I suppose I could write one-off versions of the new methods that do the same thing. Or I could pepper the scripts with ugly if-statements.
As far as mixin solutions go, I think there are two reasonable options here.
Write the methods
Self explanatory...
Wrapping function & wrapping method
Add a function to the mixin namespace, like the example below. This could be used for anything (eg if a new function is added to RGPLua along the lines of each, etc)
After I posted this, it occurred to me that it would be possible to rewrite the methods in Lua. It's not like the OSs provide a lot of support for automatic control sizing, but (especially macOS) provides at least some.
I like the fallback call idea. I'm not crazy about the double-underscores (aesthetically) for the proxy. Do you think simply all caps would sufficient future-proofing?
Is your feature request related to a problem? Please describe.
I am working on localization of some scripts using new localization tools I am developing. Specifically, I would like to localize the transposition scripts as a pilot project for other scripts in the repo. But these scripts still work with JW Lua. I would like to find an elegant solution for skipping the new method calls in RGP Lua so that the scripts can continue to work with JW Lua.
Describe the solution you'd like
It occurred to me that
mixin
might be able to provide default implementations of missing methods. What I have in mind is that any method call could provide an optional additional parameter. If the additional parameter were present (non nil), themixin
library would check for the existence of the underlying RGP Lua method. If not found, it would return either return the default value passed in or (if the method is fluid) ignore the call entirely and simply returnself
. (If found it would call the method and behave as it does now.)Describe alternatives you've considered
I suppose I could write one-off versions of the new methods that do the same thing. Or I could pepper the scripts with ugly if-statements.
@ThistleSifter
The text was updated successfully, but these errors were encountered: