GNU bug report logs - #24181
25.1.50; ruby mode: wrong auto indent after "?" string literal

Previous Next

Package: emacs;

Reported by: Ryo Furue <ryofurue <at> gmail.com>

Date: Mon, 8 Aug 2016 03:52:02 UTC

Severity: normal

Tags: wontfix

Found in version 25.1.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ryo Furue <ryofurue <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 24181 <at> debbugs.gnu.org
Subject: bug#24181: 25.1.50; ruby mode: wrong auto indent after "?" string literal
Date: Thu, 11 Aug 2016 15:41:35 +0900
Hi,

> Thanks for the report. I'd like to fix it sometime, but it's not a big
> priority, considering this syntax is usually discouraged:
>
> https://github.com/bbatsov/ruby-style-guide#no-character-literals

Thank you for the link! It seems very comprehensive and must be useful
for many other issues, too.

I agree the bug I reported isn't a big issue.

>> ?a is a valid Ruby syntax for string literal.  After writing this, I
>> learned
>> that "a".ord is equivalent (I think)
>
> Yes, in Ruby 1.9 and newer, it's a full equivalent.

After my last message, I learned that Ruby has abandoned the idea of
"character type" and instead of elevating ?a to a proper character
literal, it has made it equivalent to a single-character string "a".
So, a String is no longer a sequence of individual characters (because
"character" has no representation in the language).  "a".ord returns
the character code of this single-character string but "abc".ord
ignores the "bc" part.  I don't think that's a clean design, but
perhaps it's the simplest, practical one, in the face of various
character encodings. . . .  That makes me wonder how Haskell handles
unicode.  In that language, "String" is an alias for "[Char]"  (list
of Char's). . . . I digressed.

Cheers,

Ryo




This bug report was last modified 3 years and 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.