Feature #8462

Module.remove_const inconsistant naming

Added by Kyle Decot over 2 years ago. Updated over 2 years ago.

[ruby-core:55198]
Status:Rejected
Priority:Normal
Assignee:-

Description

The Module class in Ruby has several methods for dealing w/ constants:

const_set
const_get
const_defined?
const_missing
remove_const

The last of which is inconsistently named. I propose that we deprecate this method and create a new one called const_unset (as it's the counterpart to const_set).

History

#1 Updated by Zachary Scott over 2 years ago

  • Status changed from Open to Rejected

duplicate of #7414

#2 Updated by Charlie Somerville over 2 years ago

zzak, I don't see how this is a duplicate of #7414. Did you accidentally post the wrong issue number?

#3 Updated by Zachary Scott over 2 years ago

I may have overlooked this feature without a patch it's unclear what they
want so please reopen when you have a patch

On Sunday, June 2, 2013, charliesome (Charlie Somerville) wrote:

Issue #8462 has been updated by charliesome (Charlie Somerville).

zzak, I don't see how this is a duplicate of #7414. Did you accidentally

post the wrong issue number?

Feature #8462: Module.remove_const inconsistant naming
https://bugs.ruby-lang.org/issues/8462#change-39645

Author: kyledecot (Kyle Decot)
Status: Rejected
Priority: Normal
Assignee:
Category: core
Target version:

The Module class in Ruby has several methods for dealing w/ constants:

const_set
const_get
const_defined?
const_missing
remove_const

The last of which is inconsistently named. I propose that we deprecate
this method and create a new one called const_unset (as it's the
counterpart to const_set).

http://bugs.ruby-lang.org/

#4 Updated by Yukihiro Matsumoto over 2 years ago

remove is a dangerous operation, thus named inconsistent, as remove_instance_variable etc.

Matz.

#5 Updated by Kyle Decot over 2 years ago

I understand that it's a dangerous operation but how does naming it inconsistently make any less so other than making it difficult to find in the documentation? The fact that it's a private method I would think should be protection enough from accidental usage.

matz (Yukihiro Matsumoto) wrote:

remove is a dangerous operation, thus named inconsistent, as remove_instance_variable etc.

Matz.

#6 Updated by Kyle Decot over 2 years ago

(Sorry for the duplicate post, this one can be deleted)

kyledecot (Kyle Decot) wrote:

I understand that it's a dangerous operation but how does naming it inconsistently make any less so other than making it difficult to find in the documentation? The fact that it's a private method I would think should be protection enough from accidental usage.

matz (Yukihiro Matsumoto) wrote:

remove is a dangerous operation, thus named inconsistent, as remove_instance_variable etc.

Matz.

Also available in: Atom PDF