[#71815] [Ruby trunk - Bug #11768] [Open] Add a polymorphic inline cache — tenderlove@...
Issue #11768 has been reported by Aaron Patterson.
tenderlove@ruby-lang.org wrote:
On Thu, Dec 03, 2015 at 10:51:08PM +0000, Eric Wong wrote:
Aaron Patterson <tenderlove@ruby-lang.org> wrote:
[#71818] [Ruby trunk - Feature #11769] [Open] optimize case / when for `nil` — tenderlove@...
Issue #11769 has been reported by Aaron Patterson.
tenderlove@ruby-lang.org wrote:
[#71931] [Ruby trunk - Feature #11786] [Open] [PATCH] micro-optimize case dispatch even harder — normalperson@...
Issue #11786 has been reported by Eric Wong.
Oops, I forgot to free the table when iseq is destroyed :x
On 2015/12/08 12:43, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
On 2015/12/08 13:53, Eric Wong wrote:
[#72028] [Ruby trunk - Feature #11405] [Assigned] [PATCH] hash.c: minor speedups to int/fixnum keys — mame@...
Issue #11405 has been updated by Yusuke Endoh.
mame@ruby-lang.org wrote:
[#72045] Ruby 2.3.0-preview2 Released — "NARUSE, Yui" <naruse@...>
We are pleased to announce the release of Ruby 2.3.0-preview2.
Please add your optimizations before RC1.
SASADA Koichi <ko1@atdot.net> wrote:
On 2015/12/11 18:06, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
[#72069] [Ruby trunk - Feature #11405] [PATCH] hash.c: minor speedups to int/fixnum keys — mame@...
Issue #11405 has been updated by Yusuke Endoh.
[#72115] Re: [ruby-cvs:60264] duerst:r53112 (trunk): * enc/ebcdic.h: new dummy encoding EBCDIC-US — "U.NAKAMURA" <usa@...>
Hi,
On 2015/12/14 22:34, U.NAKAMURA wrote:
Hi,
[ruby-core:72472] [Ruby trunk - Feature #11868] Proposal for RubyVM::InstructionSequence.compile to return an object containing the syntax error information currently written to STDERR
Issue #11868 has been updated by Joe Rafaniello.
Nobuyoshi Nakada wrote:
> What's `hint`?
>
> https://github.com/ruby/ruby/compare/trunk...nobu:feature/11868-SyntaxError-location
Thank you for starting on this already. I appreciate it.
The hint/location suggestion is what ruby prints indicating where the syntax error occurred.
Sorry, hint is probably the wrong word.
In the example below:
~~~~
<compiled>:4: syntax error, unexpected keyword_not, expecting keyword_do_LAMBDA or tLAMBEG
this.is -> not -> valid $ruby:syntax
^
<compiled>:4: syntax error, unexpected tGVAR, expecting keyword_do_LAMBDA or tLAMBEG
this.is -> not -> valid $ruby:syntax
^
~~~~
There are two syntax errors.
Error 1
line number: 4
Error:
unexpected keyword_not, expecting keyword_do_LAMBDA or tLAMBEG
The "hint" or location is:
~~~~
this.is -> not -> valid $ruby:syntax
^
~~~~
Error 2
line number: 4
Error:
unexpected keyword_not, expecting keyword_do_LAMBDA or tLAMBEG
The "hint" or location is:
~~~~
this.is -> not -> valid $ruby:syntax
^
~~~~
Thank you!
----------------------------------------
Feature #11868: Proposal for RubyVM::InstructionSequence.compile to return an object containing the syntax error information currently written to STDERR
https://bugs.ruby-lang.org/issues/11868#change-55759
* Author: Joe Rafaniello
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
Currently, RubyVM::InstructionSequence.compile or RubyVM::InstructionSequence.new return a new InstructionSequence for valid ruby.
For invalid syntax, a SyntaxError is raised with a message of 'compile error'. Meanwhile, the useful information, line number(s) and hint(s) to the invalid syntax location, is printed on standard error. I am proposing this information be returned as an object in the event of a SyntaxError.
For example, here's good syntax:
~~~
RubyVM::InstructionSequence.new("x =1")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
~~~
Here's bad syntax:
~~~
RubyVM::InstructionSequence.new("puts 'hi'\n puts 'hi2'\n\nthis.is -> not -> valid $ruby:syntax")
# => SyntaxError: compile error
# The useful hint and line number(s) are on standard error:
<compiled>:4: syntax error, unexpected keyword_not, expecting keyword_do_LAMBDA or tLAMBEG
this.is -> not -> valid $ruby:syntax
^
<compiled>:4: syntax error, unexpected tGVAR, expecting keyword_do_LAMBDA or tLAMBEG
this.is -> not -> valid $ruby:syntax
^
~~~
Some ideas:
1. Add methods to all SyntaxError exceptions to get all parse failures. For example: `syntax_error.parse_failures.each {|f| puts f.lineno; puts f.hint }`. In the above example, it failed on line 4 twice and we see two "hints."
2. Create a new method to RubyVM::InstructionSequence to check ruby syntax that would allow us to see if the syntax is valid and if not, the lineno and 'hint' for each parse failure.
Use case: Rubocop[a] and other utilities[b] are really complicated and check for valid ruby syntax by creating a process to run ruby -wc with the script.
[a] https://github.com/bbatsov/rubocop/blob/86e1acf67794bf6dd5d65812b91df475e44fa320/spec/support/mri_syntax_checker.rb#L51-L63
[b] https://github.com/ManageIQ/manageiq/blob/6725fe52222c07d576a18126d2ff825ddc6dffd0/gems/pending/util/miq-syntax-checker.rb#L8-L13
It would be nice to remove all of this complexity and use RubyVM::InstructionSequence, which already has the information we need but in a more user friendly format.
Thanks!
Joe Rafaniello
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>