Project

General

Profile

Actions

Bug #19168

closed

"such file" is bad grammar

Added by masterleep2 (Bill Lipa) almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin22]
[ruby-core:111136]

Description

The error message for a missing required file has bad grammar:

$ irb
irb(main):001:0> require 'wuxx'
internal:/opt/local/lib/ruby3.1/3.1.0/rubygems/core_ext/kernel_require.rb:85:in `require': cannot load such file -- wuxx (LoadError)

The "such" should be removed. "cannot load file" reads more normally in English.

Updated by zzak (zzak _) almost 2 years ago

Judging by the diff to produce this change, we would be breaking bundler -- which probably won't work 🤔

Updated by nobu (Nobuyoshi Nakada) almost 2 years ago

In general, libraries should use LoadError#path instead of parsing the messages.
In addition, .s in a regexp don’t seem intentional.

Updated by rubyFeedback (robert heiler) over 1 year ago

Hmm. This reminds me a bit of File.exists? versus File.exist?.
Not that it is the same, mind you, but which variant is
"correct" depends on the point of view. For literal english
it would be "if file exists, do that". But from an object-centric
point of view, aka "object xyz, do you exist?" the second
variant is the more technically correct one. Just mentioning
this, even if it is not applicable in the case here.

Personally I don't mind either way really. I am so used to it
that I did not even notice it. I am more concerned with load
speed of .rb files content than any grammar-centric
consideration. ;)

Updated by jeremyevans0 (Jeremy Evans) over 1 year ago

  • Status changed from Open to Closed

Updated by headius (Charles Nutter) over 1 year ago

Note that this verbiage is similar to the standard ENOENT message: "No such file or directory". I suspect this message was just modified for load/require purposes.

Updated by masterleep2 (Bill Lipa) over 1 year ago

"No such file" is proper English, while "cannot load such file" is not. It seems like this message was written by a non native speaker. It's also one of the most common Ruby error messages that a new (or experienced) Ruby user will see.

Obviously, it is a cosmetic issue only, but I do think it would be better to have a correct grammatical message for this frequent case.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0