Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use isNotEmpty() instead of !isEmpty() #1023

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

strongly-typed
Copy link
Collaborator

Using only one part of #857

@strongly-typed strongly-typed force-pushed the feature/isnotempty branch 4 times, most recently from 5bf59a8 to a98d04c Compare May 19, 2023 09:01
@strongly-typed
Copy link
Collaborator Author

The CI hangs. Can someone re-trigger the missing jobs?

@salkinium
Copy link
Member

CI doesn't hang, it purposely doesn't execute the HAL tests until you add the ci:hal label. They take forever and block other PRs from running jobs (we only get 20 for the whole repo).
I think you have the access rights to add the label yourself (try it).

@strongly-typed strongly-typed added the ci:hal Triggers the exhaustive HAL compile CI jobs label May 19, 2023
@strongly-typed strongly-typed marked this pull request as ready for review May 19, 2023 16:37
Copy link
Member

@salkinium salkinium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I guess?

We're going to deprecate the containers in favor of stdlibc++ (or ETL) in #1020, so don't spend too much time polishing them ;-P

@chris-durand
Copy link
Member

We're going to deprecate the containers in favor of stdlibc++ (or ETL) in #1020, so don't spend too much time polishing them ;-P

Yes, the reason for the existence of most of the modm containers is that we couldn't rely on any standard library facilities at all before we had added libstdc++ for AVR. The containers are heavily dated and don't follow established practices regarding naming and semantics. That makes it hard to replace them with something else without changing all your code and interoperability with the standard library is impossible.

The plan is to get rid of everything the standard has a conceptually equivalent replacement for and deprecate the redundant containers in modm (#1020). I'd like to replace the BoundedDeque with a more modern implementation with a standard library compatible interface and also add a fixed capacity, variable size std::vector like type based on that proposal. Unfortunately the versions from ETL are not the most modern implementations either because their code base still focuses on C++03 compatibility. For instance, there is no constexpr support.

Copy link
Member

@chris-durand chris-durand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add the isNotEmpty() methods but I am sceptical of the global refactoring of !isEmpty() to isNotEmpty().

Sure it wouldn't do any harm now, but the plan is to get rid of the non-standard modm container interface in the near future. More or less everyone agrees on how container operations should be named and which the basic operations are, (e.g. standary library, ETL, boost, EASTL).
If we stick to conventions the code will be easier to work with for many people and it will be possible to change containers to some other implementation without big code modifications.

For me personally I don't see a readability improvement in isNotEmpty() over !isEmpty() because I am used to !empty() which is how it would by idiomatically expressed with any other container implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:hal Triggers the exhaustive HAL compile CI jobs
Development

Successfully merging this pull request may close these issues.

None yet

3 participants