Issue #18055 has been updated by shalokshalom (Matthias Schuster).


Hi Matz!

I see value in it, since it gives us one unified way, to call libraries:

Where ever you do it, when ever you do it, it is always the most optimal choice.

Currently, users shy away from using autoload, since its riddled with use cases, in which it can bite your back.

This gives a nice 'wrapper' around autoload and require, that lets us use always the most optimal of the two.

It can encourage, to load libraries only, when they are really used, and by that, increasing the start-up time.

I hope this can help :)

----------------------------------------
Feature #18055: Introduce
https://bugs.ruby-lang.org/issues/18055#change-93063

* Author: shalokshalom (Matthias Schuster)
* Status: Open
* Priority: Normal
----------------------------------------
Currently, ``autoload`` provides the ability to load libraries on the fly, also called lazy loading, in order to avoid huge startup times.

This has some disadvantages, who already lead nearly to its [discontinuation](https://bugs.ruby-lang.org/issues/5653)

I suggest a proposal, that solves both these issues.

``introduce``

I imagine this keyword, respectively method behaves like ```require``` at the top of the file and does act like ```autoload``` within a definition.

We can also introduce exceptions for cases like the above linked threads.

Its also a nice guideline, and easy to remember.

*Summary*: ``introduce`` can always behave predictable, optimal, and even work fine without the programmer knowing about its implementation. 


Similar issues: 
 - https://bugs.ruby-lang.org/issues/15592



-- 
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>