# Breaking change just arrived to luar

**URL:** <https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304>\
**Category:** Plugins\
**Tags:** announcement, plugins\
**Created:** [October 17, 2020, 10:40pm UTC](https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304 "2020-10-17T22:40:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gustavo-hms](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/gustavo-hms/32/598_2.png) [@gustavo-hms](https://discuss.kakoune.com/u/gustavo-hms)\
**Post date:** [October 17, 2020, 10:40pm UTC](https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304/1 "2020-10-17T22:40:09Z")

</div>

Hi, everyone!

I’ve just committed a very small but breaking change to the [luar](https://github.com/gustavo-hms/luar) plugin. Now it defines a `luar` module and the `lua` command is wrapped inside it. So, everyone using it must update `kakrc`, adding the following line:

```auto
require-module luar

```

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [October 17, 2020, 11:00pm UTC](https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304/2 "2020-10-17T23:00:19Z")

</div>

If people are going to require a module immediately at startup, why bother putting it in a module at all?

---

<div class="post-metadata">

**Author:** ![listentolist](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/listentolist/32/416_2.png) [@listentolist](https://discuss.kakoune.com/u/listentolist)\
**Post date:** [October 18, 2020, 8:11pm UTC](https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304/3 "2020-10-18T20:11:46Z")

</div>

I think, it is a good idea, to put plugins in modules, because maybe not everyone wants to load it at startup. And if you’ve got some other commands that should be run at startup and depend on `luar` you can put these commands in a `ModuleLoaded` hook, so that they get executed, when `luar` is loaded.

---

<div class="post-metadata">

**Author:** ![useredsa](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/useredsa/32/419_2.png) [@useredsa](https://discuss.kakoune.com/u/useredsa)\
**Post date:** [October 19, 2020, 9:15am UTC](https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304/4 "2020-10-19T09:15:52Z")

</div>

> [@listentolist](#):
>
> And if you’ve got some other commands that should be run at startup and depend on `luar` you can put these commands in a `ModuleLoaded` hook, so that they get executed, when `luar` is loaded.

Yes.

> [@listentolist](#):
>
> I think, it is a good idea, to put plugins in modules, because maybe not everyone wants to load it at startup.

Actually, if it’s to decrease the load time, Kakoune would anyway need to read the file, although the module would be read as a big string. Otherwise, it’s a matter of using `source` when necessary. The only benefit I’d see is to hide the declared commands when you don’t want to pollute your prompt.

---

<div class="post-metadata">

**Author:** ![TeddyDD](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/teddydd/32/21_2.png) [@TeddyDD](https://discuss.kakoune.com/u/TeddyDD)\
**Post date:** [October 19, 2020, 3:18pm UTC](https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304/5 "2020-10-19T15:18:37Z")

</div>

Since [other plugins](https://github.com/TeddyDD/kakoune-dotfiles/blob/master/private/yaml-indent.kak) might depend on luar I think this is good idea.

---

<div class="post-metadata">

**Author:** ![gustavo-hms](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/gustavo-hms/32/598_2.png) [@gustavo-hms](https://discuss.kakoune.com/u/gustavo-hms)\
**Post date:** [October 22, 2020, 11:36am UTC](https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304/6 "2020-10-22T11:36:26Z")

</div>

Hi, @Screwtapello!

> [@Screwtapello](#):
>
> If people are going to require a module immediately at startup, why bother putting it in a module at all?

Good question! And I should have addressed it in the announcement.

I decided to put `luar` inside a module mainly as a convenience to the user. It’s true that it seems to be just an additional unnecessary burden having to put a `require-module` in the `kakrc`, but there are advantages. I’m mainly thinking about users that don’t use a plugin manager and just put the plugins inside the `autoload` directory. For those, wrapping a plugin inside a module brings the following benefits:

1. One can easily temporarily disable a plugin by just commenting out a single line. From time to time I’m confronted with a situation in which something breaks in my editor and it’s not obvious where the error is comming from. I had to deal with such a situation a lot when I was using Vim, but it can also happen in Kakoune. Then, being able to disable all plugins but one is handy to find the origin of the bug.

2. As @listentolist said, it’s good for declaring dependencies: if a plugin author has a dependency on another plugin at startup, she can just put the necessary dependencies in a `ModuleLoaded` hook. And, since `luar` can be used as a library for other plugins, it seems to be a good idea.

3. Declaring dependencies is also useful for the end user. If, for instance, she writes a script inside her `autoload` that depends on `luar` being already loaded, she can just listen to the respective `ModuleLoaded` hook.

---

<div class="post-metadata">

**Author:** ![useredsa](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/useredsa/32/419_2.png) [@useredsa](https://discuss.kakoune.com/u/useredsa)\
**Post date:** [October 22, 2020, 12:02pm UTC](https://discuss.kakoune.com/t/breaking-change-just-arrived-to-luar/1304/7 "2020-10-22T12:02:31Z")

</div>

Hi @gustavo-hms. It is true what you say about dependencies. I haven’t considered that case myself, but it’s true that this plugin is particularly prone to be depended upon.

But for your first point, if you don’t put it in a module then the user can decide between putting it in their `autoload` or in a different folder and writing `source` instead of `require-module`, in which case they can also comment that line.
