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

[Feature #18915] Scope change for NotImplementedError #7201

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

Conversation

W-Mills
Copy link

@W-Mills W-Mills commented Jan 30, 2023

Issue

Resolves https://bugs.ruby-lang.org/issues/18915

Description

Updates documentation for NotImplementedError to expand its defined usage to include when a method is not implemented because it's designed to be abstract and overridden in a subclass.

Context

There is currently no semantically correct error to raise when an abstract method is defined, but designed to be implemented in a subclass only.

NoMethodError is incorrect because there is a method defined (used to declare a common interface).

Given the existing widespread adoption of NotImplementedError for this scenario, this PR simply updates the definition to consider it valid usage.

Alternative Approach Considered

I debated creating a new MustOverrideError that inherits from StandardError but opted to expand the scope of NotImplementedError given the existing adoption and semantic correctness.

- Updates documentation for NotImplementedError to consider raising it
  valid when a defined method is not implemented because it is designed
  to be abstract and overriden in a subclass.
@W-Mills W-Mills force-pushed the 18915-change-documented-scope-of-NotImplementedError branch from 16cc2b7 to 8713c13 Compare January 31, 2023 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant