From: sawadatsuyoshi@...
Date: 2014-03-24T09:19:05+00:00
Subject: [ruby-core:61653] [ruby-trunk - Feature #9667] [Open] Optimization of __FILE__ and __dir__

Issue #9667 has been reported by Tsuyoshi Sawada.

----------------------------------------
Feature #9667: Optimization of __FILE__ and __dir__
https://bugs.ruby-lang.org/issues/9667

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
In the same spirit as the string literal followed by `freeze` is optimized, I think `__FILE__` and `__dir__` should be optimized. Currently, they return different object id each time they are called.

    __FILE__.object_id # => 70183725179420
    __FILE__.object_id # => 70183725129020
    ...

I propose them to be optimized so that they are only created once per occurrence.

    __FILE__.object_id # => 70183725179420
    __FILE__.object_id # => 70183725179420
    ...



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