Project

General

Profile

Actions

Feature #16495

open

Inconsistent quotes in error messages

Added by Kolano (Kenneth Kolano) over 2 years ago. Updated 2 months ago.

Status:
Open
Priority:
Normal
Target version:
-
[ruby-core:96742]

Description

Error messages use inconsistent pairs of quotes, for instance:

-e:1:in `<main>': undefined local variable or method `foo' for main:Object (NameError)

where a back tick is used on the left-hand side, and a single quote is used on the right.

The same quotes should be used on either side of the elements being quoted.


Related issues 3 (0 open3 closed)

Related to Ruby master - Bug #12321: Backticks in log output cause issuesRejectedActions
Related to Ruby master - Bug #13589: unmatched opening backtick / closing quote in NoMethodError: undefined method `name' for {}:HashRejectedActions
Is duplicate of Ruby master - Bug #17107: Backtick in backtrace is a little bit annoyingRejectedActions
Actions #1

Updated by jeremyevans0 (Jeremy Evans) over 2 years ago

  • Backport deleted (2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN)
  • ruby -v deleted (2.5.3)
  • Tracker changed from Bug to Feature

Updated by shevegen (Robert A. Heiler) over 2 years ago

Hmm. Is this encoding-related perhaps? I remember having had that when I used ISO (ISO-8859-1 specifically, and
a non-utf locale too). Nowadays, with Unicode, I don't seem to have this inconsistent quote - but I understand
what you refer to. I used to think that it was used to denote the start, and end part of the content. :P
(They are not the same characters in general right? Otherwise they would appear the same. I always thought it
may be some standard, perhaps to make parsing easier or something.)

Never bothered me that much to really investigate, though.

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

This combination is very common, e.g., Emacs, TeX, etc.

Actions #4

Updated by mame (Yusuke Endoh) over 2 years ago

  • Related to Bug #12321: Backticks in log output cause issues added
Actions #5

Updated by mame (Yusuke Endoh) over 2 years ago

  • Related to Bug #13589: unmatched opening backtick / closing quote in NoMethodError: undefined method `name' for {}:Hash added
Actions #6

Updated by sawa (Tsuyoshi Sawada) over 2 years ago

  • Description updated (diff)
  • Subject changed from Inconsistant Quotes in Error Messages to Inconsistent quotes in error messages

Updated by matz (Yukihiro Matsumoto) over 2 years ago

It was something cultural. I admit nowadays very few people use backquote as a left-hand quote, but it used to be. I also admit consistent quotes are easier for our eyes when using recent major fonts. But changing those quotes may affect existing log parsers. We have to estimate how big is the influence of the changes.

Matz.

Updated by Dan0042 (Daniel DeLorme) over 2 years ago

Maybe a fix could involve customization of which quotes to display via an ENV var or something?
Instead of changing the code all over the place you'd just be changing e.g. rb_sprintf to replace matching sets of ` and ' to use the custom quotes.
So it would be possible to dynamically set the quotes to ' and ' (or even unicode ‘ and ’) if you don't use log parsers that rely on the regular behavior.
Log parsers could eventually use these custom quotes for their parsing.
It would be possible for individuals to gradually experiment and report bugs where custom quote are causing trouble.
Just an idea...

Updated by marcandre (Marc-Andre Lafortune) over 2 years ago

  • Assignee set to matz (Yukihiro Matsumoto)

I fail to see the actual gain.

This would introducing potential incompatibilities. For example, I remember parsing using these quotes myself (this code isn't used for recent rubies so doing the change wouldn't actually affect it).

Please reject this.

Updated by zverok (Victor Shepelev) over 2 years ago

I fail to see the actual gain.

As it was already pointed in related tickets, the gain (or rather the problem solved) comes when the error message is copy-pasted into any input field supporting Markdown or Markdown-alike syntax. This includes this very tracker; and GitHub/GitLab comments/PRs; and Slack and any of its open- or closed-source modern alternatives, like Gitter or Mattermost; and almost any other of developer-friendly software that emerged in the last 10 years or so. I believe it is relatively small, but constantly annoying problem.

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

zverok (Victor Shepelev) wrote:

I fail to see the actual gain.

As it was already pointed in related tickets, the gain (or rather the problem solved) comes when the error message is copy-pasted into any input field supporting Markdown or Markdown-alike syntax. This includes this very tracker; and GitHub/GitLab comments/PRs; and Slack and any of its open- or closed-source modern alternatives, like Gitter or Mattermost; and almost any other of developer-friendly software that emerged in the last 10 years or so. I believe it is relatively small, but constantly annoying problem.

Why don't you use block quoting?

Updated by zverok (Victor Shepelev) over 2 years ago

@nobu (Nobuyoshi Nakada)

Why don't you use block quoting?

Because error messages are by their nature something you frequently want to communicate quickly and inline?
Here are some examples of backtick breaking communication: https://gist.github.com/zverok/a4fcacab3dc06d9d7585c82cad8a8dc6

Updated by vlad0337187 (Vladislav Ivanov) about 2 years ago

Some terminals don't highlight text inside different quotes (for example, Iterm2, Terminal on Mac).
So you're going to double-click, copy; but have to highlight text manually.

Actions #14

Updated by hsbt (Hiroshi SHIBATA) about 2 years ago

  • Is duplicate of Bug #17107: Backtick in backtrace is a little bit annoying added

Updated by ioquatix (Samuel Williams) 2 months ago

The more pervasive Markdown becomes, the more annoying this quoting style becomes.

Updated by nobu (Nobuyoshi Nakada) 2 months ago

zverok (Victor Shepelev) wrote in #note-12:

Because error messages are by their nature something you frequently want to communicate quickly and inline?
Here are some examples of backtick breaking communication: https://gist.github.com/zverok/a4fcacab3dc06d9d7585c82cad8a8dc6

Why don't you use double- or triple-backticks?

Ugh, do you know why am I having undefined local variable or method `foo' for main:Object?.. I expected it to work for Logger.

Updated by ioquatix (Samuel Williams) 2 months ago

Why don't you use double- or triple-backticks?

Because that doesn't work for inline Markdown.

Updated by nobu (Nobuyoshi Nakada) 2 months ago

https://daringfireball.net/projects/markdown/syntax#code

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:

``There is a literal backtick (`) here.``

which will produce this:

<p><code>There is a literal backtick (`) here.</code></p>

Updated by ioquatix (Samuel Williams) 2 months ago

Not sure if it's well supported, it doesn't work in GitHub issue title which is one place where I have this problem.

https://github.com/socketry/async/issues/50

Updated by nobu (Nobuyoshi Nakada) 2 months ago

As it seems working in other than titles, it would be an issue of GitHub.
You should report it to GitHub, not here.

Updated by zverok (Victor Shepelev) 2 months ago

@nobu (Nobuyoshi Nakada) Even where it works, it is not common knowledge of the way to hack around the necessity to post a singular backtick. Note that it was discovered in the current issue after 2 years of a discussion. (I use markdown almost every day since it was invented, and wrote some toy parsers/transformers for it, and still I didn't know about the two-backticks trick, because of how rarely this need arises)

What the people do every day and everywhere is pasting Ruby exception messages, seeing them converted, becoming frustrated, editing; rinse, repeat. Which is the cause of the current issue.

I wonder what is the necessity to preserve this legacy convention of assimetric `quotes'?.. Just because it is already this way?.. (If you ask me, it irked me always as also looking weird in the terminal, but maybe it is something personal)(

Updated by sawa (Tsuyoshi Sawada) 2 months ago

zverok (Victor Shepelev) wrote in #note-21:

(If you ask me, it irked me always as also looking weird in the terminal, but maybe it is something personal)(

Speaking of irking, the weird practice of putting three periods before and after a code block cited in a text, just like how this issue originally was written before my edit https://bugs.ruby-lang.org/journals/83743/diff?detail_id=56117 , is much more irking than using `' for quotes. The author of this issue should have at least payed attention to use correct punctuation when discussing punctuation. This proposal is very unconvincing.

Updated by austin (Austin Ziegler) 2 months ago

zverok (Victor Shepelev) wrote in #note-21:

I wonder what is the necessity to preserve this legacy convention of assimetric `quotes'?.. Just because it is already this way?.. (If you ask me, it irked me always as also looking weird in the terminal, but maybe it is something personal)

It’s not personal, it‘s based on the fact that the terminal emulators we have been using for a very long time have not supported the exact same fonts as the terminals did, even back in 1989 when I got access. Right now, ' is usually displayed as a vertical quarter bar from the top, but it was displayed on most VT series terminals the same as (raised comma). ` wasn’t shown as a bare grave accent, but was shown as a raised reversed comma, or .

Like you, I did not know the double backtick trick, even though I’ve been using Markdown since very early (and you need spaces for ` to work, per the Common Mark spec https://spec.commonmark.org/0.30/#code-spans).

Many editors expect GNU-style quoting, so changing the formatting for Ruby would have substantial downstream impact (https://cs.github.com/gcc-mirror/gcc?q=%2F%60%25s%27%2F).

There’s strong opinions (https://english.stackexchange.com/questions/17695/any-reference-on-the-usage-of-a-backtick-and-single-quotation-mark-like-this/) about whether it’s good or bad practice, and I’d love to see it change entirely, but that may be asking a bit much from an entire computer industry.

Updated by zverok (Victor Shepelev) 2 months ago

the weird practice of putting three periods before and after a code block cited in a text

It is a cultural difference. In many languages/writing conventions, three dots is a sign of "phrase broken in the middle". Can be used when leaving the text unfinished ("I thought it would work, but..."), or to mark a place of insertion of a different content that breaks the text flow, to signify that the phrase continues below: "I've seen photos like... {picture} ...and always thought that it is beautiful".

As a Russian/Ukrainian speaker, I find it natural (note that I am not an original ticket's author, though). In American English, the breaking is more frequently signified with — ("I thought it would work, but—").

That being said, I find your marking it as a "weird practice" and fixing other people's punctuation you find "weird", as well as it being used as a response to my note on my personal perception of exception rendering pretty flabbergasting.

I will stop commenting on this ticket, then.

Actions

Also available in: Atom PDF