Project

General

Profile

Actions

Feature #8462

closed

Module.remove_const inconsistant naming

Added by kyledecot (Kyle Decot) almost 11 years ago. Updated almost 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:55198]

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).

Updated by zzak (zzak _) almost 11 years ago

  • Status changed from Open to Rejected

duplicate of #7414

Updated by Anonymous almost 11 years ago

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

Updated by zzak (zzak _) almost 11 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/

Updated by matz (Yukihiro Matsumoto) almost 11 years ago

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

Matz.

Updated by kyledecot (Kyle Decot) almost 11 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.

Updated by kyledecot (Kyle Decot) almost 11 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.

Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like0Like0Like0