Pre-built Stack Class in the Dart Standard Library #56077
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-collection
type-enhancement
A request for a change that isn't a bug
Currently, the Dart standard library does not provide a pre-built Stack class like Java. While it's possible to implement a stack using a List, having a dedicated class could offer several benefits:
Improved Readability: Explicit Stack usage clarifies code intent.
Potential Performance Optimizations: A dedicated class might allow for optimizations beyond a basic List implementation.
Type Safety: A built-in stack could offer compile-time type checking for elements.
Why This Feature Would Be Useful:
A pre-built Stack class would enhance the Dart ecosystem by:
Reducing Boilerplate Code: Developers wouldn't need to write their own stack implementations.
Enhancing Consistency: Standardizing stack usage across Dart projects.
Promoting Readability: Making code more explicit and easier to understand.
Alternative Solutions (Acknowledging Current Approach):
We understand that the current approach of using a List for stacks is viable. However, a dedicated class could provide advantages in terms of readability, type safety, and potential performance optimizations.
Open to Discussion:
We're open to discussing the trade-offs between a pre-built Stack class and the existing List approach. We value feedback from the Dart community to determine the best course of action.
Up-vote or Comment:
Please up-vote this issue if you support the addition of a pre-built Stack class to the Dart standard library. Feel free to leave comments with your thoughts and suggestions.
The text was updated successfully, but these errors were encountered: