Project

General

Profile

Actions

Feature #21041

open

Enum class

Added by dsisnero (Dominic Sisneros) 6 days ago. Updated 6 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:120703]

Description

Enumerations (Enums) represent a critical abstraction in modern software design, offering significant advantages in type safety, code readability, and system-wide consistency. Most contemporary programming ecosystems—including Java, C#, Python, and Kotlin—provide native enum support, recognizing their fundamental value in representing finite, well-defined sets of values.

Beyond basic type definition, enums are increasingly central to interoperability across serialization frameworks. Industry-standard specifications like OpenAPI, Protocol Buffers, and gRPC leverage enums as a canonical way to define constrained value sets, enabling robust code generation and cross-platform compatibility.

Implementing a comprehensive Enum class would:

  • Standardize constant representation
  • Facilitate seamless code portability
  • Enable automatic code generation for documentation and client libraries
  • Enhance type safety and compile-time validation
  • Improve developer productivity through clear, self-documenting code structures

By adopting a robust enum implementation, we can align our development practices with contemporary software engineering principles, reducing complexity and increasing overall system reliability.

Updated by alanwu (Alan Wu) 6 days ago

Without any concrete design proposal and implementation, I'm afraid this boils down to "enums in ruby would be nice". I think successful feature proposals need more details than this.

... Am I talking to an LLM?

Updated by dsisnero (Dominic Sisneros) 6 days ago

I wrote a proposal with my own words and had an llm make it sound better. Yes, it needs concrete implementation but put it here for feedback

Updated by ufuk (Ufuk Kayserilioglu) 6 days ago

I think the main feedback is that a feature request needs to fulfill the criteria listed here: https://github.com/ruby/ruby/wiki/How-To-Request-Features

As @alanwu (Alan Wu) said, without a concrete design proposal, there is nothing to really discuss, since the devil is in the details.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like1