From: shevegen@... Date: 2017-10-03T23:58:58+00:00 Subject: [ruby-core:83092] [Ruby trunk Feature#13936] Make regular expressions debugable Issue #13936 has been updated by shevegen (Robert A. Heiler). I am inclined to agree with Martin. In general introspection is awesome; I remember many years having used Steve Dekorte's Io language; the syntax was not so nice, but the introspection was nice (I think that was back when ruby did not have method_location or source_location or whatever was the name either; banister wrote that show-method thing in pry via the gem method_source). I remember that I ran into encoding-related problems with regexes which were not trivial to resolve for me back then. I am not familiar with the internals so I can't say much about it, but I am all for better introspection; and also being able to easily set which encoding a regexp is in (I have not tried again but back when I ran into these problems, it was not so trivial to resolve). The documentation says to use any of these: /pat/u - UTF-8 /pat/e - EUC-JP /pat/s - Windows-31J /pat/n - ASCII-8BIT But I would ideally prefer to have Regexp also use methods similar to class String, in particular .force_encoding() which I tend to use a lot (whenever I am not using UTF-8). If anyone wants to have a look at the docu of Regexp, here the quick link to the main documentation: https://ruby-doc.org/core/Regexp.html ---------------------------------------- Feature #13936: Make regular expressions debugable https://bugs.ruby-lang.org/issues/13936#change-67042 * Author: duerst (Martin D��rst) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Ruby has all kinds of features that allow a programmer to look at internals, in particular for debugging. However, one important part of Ruby, regular expressions, don't have any such features yet. Onigmo, the regular expression engine used in MRI, has compile-time switches to output various kinds of debugging information. This is a general proposal to gauge interest in the ability to debug regular expressions, e.g. by looking at the parse tree, the instruction sequence, and execution-time information. Because such information can be very large, in particular execution-time information, we have to make sure that the interface is designed carefully, but I'd like to concentrate on the general desirability/usefulness (or the absence of it) for such a feature. If there is positive feedback, I plan to implement the necessary features in Onigmo proper, and then add the necessary API methods (and maybe options,...) to Ruby. -- https://bugs.ruby-lang.org/ Unsubscribe: