Why wasn't there a `DEPRECATED` tag used for `OneShot.double_tap_sticky` etc


(Shriramana Sharma) #1

At https://github.com/keyboardio/Kaleidoscope/commit/dbaba6c1ef068aa34a0a7970494594b0a80ae9bd#diff-fe09b5bc90a39e2fb10f87f678f3e4edR82 I see that the deprecated Layer methods were tagged with DEPRECATED which ensured that a deprecation message would be emitted while compiling, but at https://github.com/keyboardio/Kaleidoscope/commit/7ccb5bfa635508c5d305d422e138c930576c9dfa#diff-8f9c1338eaf62f816d813b24392771cbR441 I don’t see the same done for OneShot. Was this merely an oversight?

I note that the deprecation messages are placed inside src/kaleidoscope_internal/deprecations.h so is it because OneShot is a plugin but Layer is Kaleidoscope internal that such a message wasn’t added there?


(Gergely Nagy) #2

We didn’t add one for OneShot, because we couldn’t. We can add deprecation messages to methods, but not to member variables. That’s one of the reasons we’re trying to transition to using accessors for new code.


(Shriramana Sharma) #3

OK. If I wanted a plugin method to be deprecated, would it still go into the same deprecation header though it’s not “internal”?


(Gergely Nagy) #4

You can put the deprecation message anywhere, it doesn’t have to be in src/kaleidoscope_internal/deprecations.h, you can put it in your plugin header too. As long as the #define name is _DEPRECATED_MESSAGE_something, DEPRECATED(something) will work.

See the HostOS.autoDetect() deprecation for example, which was in HostOS.h. For plugins, I think the most straightforward thing is to place the message in the plugin header, whether the plugin is part of the monorepo or not.

src/kaleidoscope_internal/deprecations.h should only be used for deprecations in core Kaleidoscope (ie, not plugins).