Project

General

Profile

Feature #9969

Add File.empty? as alias to File.zero?

Added by shevegen (Robert A. Heiler) almost 3 years ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:63269]

Description

Could we alias File.empty? to File.zero? ?

The latter already exists. I tried to use File.empty?
and then thought it would not exist, but the code
already exists, it is just called File.zero? instead.

Associated revisions

Revision 54559
Added by nobu (Nobuyoshi Nakada) 12 months ago

file.c: File.empty?

  • file.c (Init_File): add alias File.empty? to File.zero?. [Feature #9969]

Revision 54559
Added by nobu (Nobuyoshi Nakada) 12 months ago

file.c: File.empty?

  • file.c (Init_File): add alias File.empty? to File.zero?. [Feature #9969]

Revision 54560
Added by nobu (Nobuyoshi Nakada) 12 months ago

NEWS: [Feature #9969]

Revision 54560
Added by nobu (Nobuyoshi Nakada) 12 months ago

NEWS: [Feature #9969]

History

#1 [ruby-core:63451] Updated by zzak (Zachary Scott) over 2 years ago

  • Tracker changed from Bug to Feature
  • Priority changed from 3 to Normal
  • Target version set to 2.2.0

#2 [ruby-core:73867] Updated by lucasbuchala (Lucas Buchala) about 1 year ago

I added a comment on issue #10121 before knowing this specific issue already existed.

I just wanted to say that, with the arrival of Dir.empty?, I like the idea of the File.empty? alias for the reason of having some symmetry between Dir and File methods.

#3 [ruby-core:74919] Updated by matz (Yukihiro Matsumoto) 12 months ago

OK, agreed.

Matz.

#4 Updated by nobu (Nobuyoshi Nakada) 12 months ago

  • Status changed from Open to Closed

Applied in changeset r54559.


file.c: File.empty?

  • file.c (Init_File): add alias File.empty? to File.zero?. [Feature #9969]

#5 [ruby-core:76384] Updated by backus (John Backus) 8 months ago

For the sake of consistency could you also add Pathname#empty?. Alternatively maybe add both Pathname#empty_file? and Pathname#empty_directory?. It is probably important to keep Pathname consistent with File and/or Dir since the tool is much less useful if you sometimes have to fallback to File or Dir for certain use cases

#6 [ruby-core:76391] Updated by duerst (Martin Dürst) 8 months ago

John, this feature is already closed. If you want your proposal to be
looked at, please open a new one, referencing this one.

Thanks, Martin.

On 2016/07/18 12:56, johncbackus@gmail.com wrote:

Issue #9969 has been updated by John Backus.

For the sake of consistency could you also add Pathname#empty?


Feature #9969: Add File.empty? as alias to File.zero?
https://bugs.ruby-lang.org/issues/9969#change-59632

  • Author: Robert A. Heiler
  • Status: Closed
  • Priority: Normal

* Assignee:

Could we alias File.empty? to File.zero? ?

The latter already exists. I tried to use File.empty?
and then thought it would not exist, but the code
already exists, it is just called File.zero? instead.

Also available in: Atom PDF