[#70257] [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI — ko1@...

Issue #11420 has been reported by Koichi Sasada.

11 messages 2015/08/06

[ruby-core:70536] [Ruby trunk - Feature #6251] [Feedback] Magic comments for compile options

From: ko1@...
Date: 2015-08-21 23:47:26 UTC
List: ruby-core #70536
Issue #6251 has been updated by Koichi Sasada.

Description updated
Status changed from Assigned to Feedback
Assignee changed from Koichi Sasada to Yukihiro Matsumoto

I have no idea such magic comment is acceptable or not.

Matz's issue?

----------------------------------------
Feature #6251: Magic comments for compile options
https://bugs.ruby-lang.org/issues/6251#change-53944

* Author: Shugo Maeda
* Status: Feedback
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Currently, compile options can be set by RubyVM::InstructionSequence.compile_option=.
However, it takes effect only on code compiled after the options are set.

So, how about to add new magic comments for compile options?
For example, the following code sets the options tailcall_optimization and trace_instruction.

```ruby
  # -*- tailcall-optimization: true; trace-instruction: false -*-
  
  def fact(n, i = 1)
    if n == 0
      i
    else
      fact(n - 1, n * i)
    end
  end
  p fact(10000)
```

With the attached patch, magic comments in the main script sets global options, and magic comments in a required library are effective only in that library.


---Files--------------------------------
magic-comments-for-compile-options.diff (7.66 KB)


-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next