Skip to content

Make plugin autoloadable#96

Closed
somini wants to merge 2 commits intotpope:masterfrom
somini:autoload
Closed

Make plugin autoloadable#96
somini wants to merge 2 commits intotpope:masterfrom
somini:autoload

Conversation

@somini
Copy link
Copy Markdown

@somini somini commented Dec 17, 2017

Similar to #78, to the latest master.

@somini
Copy link
Copy Markdown
Author

somini commented Apr 23, 2018

Updated to the latest version.

@tpope
Copy link
Copy Markdown
Owner

tpope commented Apr 24, 2018

The plugin fits into one 4k disk sector. What could possibly be the value in autoloading it?!

@chrisbra
Copy link
Copy Markdown

What could possibly be the value in autoloading it?!

At least in my case, I consider it a good approach to only loading anything until it is really needed.

@somini
Copy link
Copy Markdown
Author

somini commented Apr 25, 2018

Another plus is "forcing" defining a clear separation between internal functions and an exposed API.

@tpope
Copy link
Copy Markdown
Owner

tpope commented Apr 25, 2018

The counterpoint is that a single file plugin is significantly easier for ad hoc installations, like if you want to dump it on a random server, for example. It's a small thing, but it does win out over minor code organization concerns.

Furthermore, all functions in Commentary are internal, but autoloading requires me to expose them as an implementation detail. It doesn't force a clear separation, it prevents it. In dispatch.vim, for example, the official API is :Make (so you can swap in :make if it's not available, and avoid a hard dependency), but people are sometimes distracted by internal APIs that are necessarily exposed. The namespacing is great for when you do want to expose functions, but I have no reason to do that here.

@tpope tpope closed this Apr 25, 2018
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

Successfully merging this pull request may close these issues.

3 participants