[#114936] [Ruby master Feature#19908] Update to Unicode 15.1 — "nobu (Nobuyoshi Nakada) via ruby-core" <ruby-core@...>

Issue #19908 has been reported by nobu (Nobuyoshi Nakada).

24 messages 2023/10/02

[#115016] [Ruby master Bug#19921] TestYJIT#test_bug_19316 test failure — "vo.x (Vit Ondruch) via ruby-core" <ruby-core@...>

Issue #19921 has been reported by vo.x (Vit Ondruch).

21 messages 2023/10/12

[#115033] [Ruby master Misc#19925] DevMeeting-2023-11-07 — "mame (Yusuke Endoh) via ruby-core" <ruby-core@...>

Issue #19925 has been reported by mame (Yusuke Endoh).

12 messages 2023/10/13

[#115068] [Ruby master Bug#19929] Warnings for `mutex_m`, `drb` and `base64` appears while the gem spec has explicit dependencies — "yahonda (Yasuo Honda) via ruby-core" <ruby-core@...>

Issue #19929 has been reported by yahonda (Yasuo Honda).

8 messages 2023/10/17

[#115071] [Ruby master Misc#19931] to_int is not for implicit conversion? — "Dan0042 (Daniel DeLorme) via ruby-core" <ruby-core@...>

Issue #19931 has been reported by Dan0042 (Daniel DeLorme).

16 messages 2023/10/17

[#115139] [Ruby master Bug#19969] Regression of memory usage with Ruby 3.1 — "hsbt (Hiroshi SHIBATA) via ruby-core" <ruby-core@...>

Issue #19969 has been reported by hsbt (Hiroshi SHIBATA).

8 messages 2023/10/24

[#115165] [Ruby master Bug#19972] Install default/bundled gems into dedicated directories — "vo.x (Vit Ondruch) via ruby-core" <ruby-core@...>

Issue #19972 has been reported by vo.x (Vit Ondruch).

11 messages 2023/10/25

[#115196] [Ruby master Feature#19979] Allow methods to declare that they don't accept a block via `&nil` — "ufuk (Ufuk Kayserilioglu) via ruby-core" <ruby-core@...>

Issue #19979 has been reported by ufuk (Ufuk Kayserilioglu).

21 messages 2023/10/29

[ruby-core:114978] [Ruby master Misc#19912] [Small potential for slight improvement in regards to trailing / that were omitted in a regex]

From: "nobu (Nobuyoshi Nakada) via ruby-core" <ruby-core@...>
Date: 2023-10-08 07:12:14 UTC
List: ruby-core #114978
Issue #19912 has been updated by nobu (Nobuyoshi Nakada).


I've forgot about inline option and comment, so it was complicated than I thought first.
https://github.com/nobu/ruby/tree/warn-multiline-regexp

----------------------------------------
Misc #19912: [Small potential for slight improvement in regards to trailing / that were omitted in a regex]
https://bugs.ruby-lang.org/issues/19912#change-104850

* Author: rubyFeedback (robert heiler)
* Status: Open
* Priority: Normal
----------------------------------------
Not sure if I should file this under bug or not; it is probably not a bug per se
and just the current behaviour. So I filed it under Misc here.

So let me copy/paste the code next:

    alias e puts


    i = 'abc'

      case i
      when /help
        e 'No help options are currently documented.'
      when /-?-?rotate=(\d+)$/i
          pp $1.to_s
          exit
      end

    end

I isolated this from a larger .rb file. I was adding support for
--rotate= for a class tasked with commandline stuff in regards to
.pdf files, e. g. rotating wrong .pdf files.

When I run this .rb file, that is the one I showed above, I get 
the following error, as-is (the extra "end" is kind of deliberate,
I had a much larger case/when structure before).

    foo.rb: --> foo.rb
    Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ?
    >  4  i = 'abc'
    >  6    case i
    >  7    when /help
    >  8      e 'No help options are currently documented.'
    >  9    when /-?-?rotate=(\d+)$/i
    > 12    end
    > 14  end
    foo.rb:9: syntax error, unexpected backslash (SyntaxError)
      when /-?-?rotate=(\d+)$/i
                    ^

Because there are at the least two problems in this .rb file,
it appears to be that the ruby parser focuses on the last
error found. To those who can not instantly find the error,
I simply forgot a trailing / in the case/when menu, at
"when /help". That actually was the real bug too. But I first
looked down, where ruby alerted me that there is an issue
with "when /-?-?rotate=(\d+)$/i". The real problem was the
missing "/".

Is there potential to improve handling of such small mistakes,
specifically someone forgetting a trailing / in a case/when
menu? I assume ruby has to decide what is going on, but usually
when I use a case/when menu, I have multiple such entries, so
perhaps this gives the ruby parser additional information it
could use, such as: "look at the immediate surrounding and
then determine whether this may be a missing /".

I don't know how difficult it is to add that, and if it is too
much work then I think the time may be spent elsewhere. But on
the other hand, if the ruby parser could detect such small 
mistakes more easily (a forgotten /), this would be rather nice
to have.

This may also have to do with how ruby reports errors; I guess
the part "Unmatched `end', missing keyword (`do', `def`, `if`,
etc.) ?" is ruby's attempt to give useful information to the 
user, and in many cases this should work. But in case of simple
errors such as the above it may not work, and secondary errors
may disguise or confuse the user momentarily. I usually look at
the last part of any long trace shown by the ruby parser to me,
so that is why I sometimes miss prior errors.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

In This Thread

Prev Next