New release and deprecate duration() #82

Closed
opened 2022-01-24 12:14:57 +03:00 by Stutchbury · 7 comments
Stutchbury commented 2022-01-24 12:14:57 +03:00 (Migrated from github.com)

Hi Thomas - thank you very much for your excellent library.

Could I request a new release/pull to the Arduino Library repository and if possible, to mark duration() as deprecated?

Many thanks

Hi Thomas - thank you very much for your excellent library. Could I request a new release/pull to the Arduino Library repository and if possible, to mark ```duration()``` as deprecated? Many thanks
thomasfredericks commented 2022-01-24 16:52:22 +03:00 (Migrated from github.com)

I thought I might have acted quickly enough as duration was a new fixture. Is duration still documented? I have yet to find the right way to mark some functions as deprecated only when used...

I thought I might have acted quickly enough as `duration` was a new fixture. Is `duration` still documented? I have yet to find the right way to mark some functions as deprecated only when used...
Stutchbury commented 2022-01-24 19:49:58 +03:00 (Migrated from github.com)

I'm not sure if it was documented or not but it is listed as 'public:' in the v2.60 release that is available via the Arduino Library Manager.

WRT deprecation markup, I'm not sure either - C++ is not my first language...

Happy to align with your releases - I just got an issue raised on my EncoderButton library, so thought I'd pass it on ;-)

I'm not sure if it was documented or not but it is listed as 'public:' in the v2.60 release that is available via the Arduino Library Manager. WRT deprecation markup, I'm not sure either - C++ is not my first language... Happy to align with your releases - I just got an issue raised on my EncoderButton library, so thought I'd pass it on ;-)
thomasfredericks commented 2022-02-05 00:39:04 +03:00 (Migrated from github.com)

Do you need me to readd duration() and mark it as deprecated (as I removed it)? Or can we consider the issue resolved?

Do you need me to readd duration() and mark it as deprecated (as I removed it)? Or can we consider the issue resolved?
Stutchbury commented 2022-02-05 00:44:36 +03:00 (Migrated from github.com)

If you can work out how to mark it, that would be good for anyone who uses your latest git with my library release (I suspect a very small pool) but if/when you create a new release for the Arduino Library Manager, I'll update my code & create a new release.

Thank you.

If you can work out how to mark it, that would be good for anyone who uses your latest git with my library release (I suspect a very small pool) but if/when you create a new release for the Arduino Library Manager, I'll update my code & create a new release. Thank you.
cameroncking commented 2022-03-19 06:56:55 +03:00 (Migrated from github.com)

Ideally, with semantic versioning, this would be a breaking change and should result in an increase in major version. Library managers that depend on semantic versioning will "do the right thing" in that case.

For example, some packages are consuming Bounce2 via. platformio using a version string such as thomasfredericks/Bounce2@^2.60. This indicates that the package wants to consume the latest non-breaking change starting with 2.60. (Where the version is x.y.z, x is fixed while y and z can update.) Packages who do this (which is the default behavior) and also use the duration function (such as lendres/ButtonSuite and Stutchbury/EventButton) are now more difficult to use.

The workaround is to use something like thomasfredericks/Bounce2@~2.60, which would say that the package wishes to receive patches only, no breaking changes or feature improvements. (Where the version is x.y.z, x and y are fixed while z can update.)

In my case, I've added thomasfredericks/Bounce2@~2.60 to my platformio.ini lib_deps directly, which solved the problem for me in the interim.

The cleanest solution, which would align with semver (and therefore cause correct behavior in library managers) would be to wrap Debouncer::currentDuration with Debouncer::duration, in the v2 branch, and if you would like to remove duration entirely - to release that as 3.0.0.

Ideally, with [semantic versioning](https://semver.org/), this would be a breaking change and should result in an increase in major version. Library managers that depend on semantic versioning will "do the right thing" in that case. For example, some packages are consuming Bounce2 via. platformio using a version string such as `thomasfredericks/Bounce2@^2.60`. This indicates that the package wants to consume the latest non-breaking change starting with 2.60. (Where the version is x.y.z, x is fixed while y and z can update.) Packages who do this (which is the default behavior) and also use the duration function (such as lendres/ButtonSuite and Stutchbury/EventButton) are now more difficult to use. The workaround is to use something like `thomasfredericks/Bounce2@~2.60`, which would say that the package wishes to receive patches only, no breaking changes _or_ feature improvements. (Where the version is x.y.z, x and y are fixed while z can update.) In my case, I've added `thomasfredericks/Bounce2@~2.60` to my platformio.ini lib_deps directly, which solved the problem for me in the interim. The cleanest solution, which would align with semver (and therefore cause correct behavior in library managers) would be to wrap Debouncer::currentDuration with Debouncer::duration, in the v2 branch, and if you would like to remove duration entirely - to release that as 3.0.0.
thomasfredericks commented 2022-03-21 17:06:47 +03:00 (Migrated from github.com)

Done

Done
Stutchbury commented 2022-03-21 18:02:05 +03:00 (Migrated from github.com)

Thanks Thomas

Thanks Thomas
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Max/thomasfredericks_Bounce2#82