Skip to content

Auto class loader, similar to php. for lazy instantiation of objects #36331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JhulFramework opened this issue Mar 25, 2019 · 1 comment
Closed

Comments

@JhulFramework
Copy link

In My Application I just want to register classes and instantiate them only when needed. it will improve performance of app.
Please implement this if it is possible.

https://www.php.net/manual/en/language.oop5.autoload.php

Thank you

@eernstg
Copy link
Member

eernstg commented Mar 25, 2019

Take a look at the section 'Lazily loading a library' in the language tour. Loading a 'deferred' library may not be exactly the same thing as 'registering and instantiating a class', but the deferred library mechanism was created in order to obtain fast startup times in return for some explicit management of the actual time where a library is loaded.

PS: This mechanism was considered important for the web platform, but a similar case wasn't made for the VM; so on the VM you will be able to use the code for deferred libraries, but the loading won't actually be deferred (check out #33118).

@kevmoo kevmoo closed this as completed Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants