On Mon, Mar 16, 2020 at 4:08 PM Brian Theado <brian.the...@gmail.com> wrote:

>
>
> On Mon, Mar 16, 2020 at 6:23 AM Edward K. Ream <edream...@gmail.com>
> wrote:
>
>> When I awoke this morning I understood why you might suggest this. It
>> would, supposedly, make it possible to instantiate multiple instances of
>> the LeoApp class.  I have just created #1537
>> <https://github.com/leo-editor/leo-editor/issues/1537> for this.
>>
>
> Thanks. Multiple instances of the class is just one possible benefit of
> reduced coupling. I may make a pull request for this and if I do, I will
> tag it with #1537.
>
>
>> As noted in the issue, it's not clear whether changing `g.app` to `self`
>> in the LeoApp class would make any real difference. It might well mislead
>> people.
>>
>
> I agree it is just a drop in the ocean and to me it still makes a
> difference. There are always tradeoffs. Is referencing a global variable
> rather than self in every single method the best (or even a good) way to
> not mislead people about the (current) requirement that LeoApp be a
> singleton object? I don't think it is.
>
>
>> The fact that g.app is a *singleton* instance of the LeoApp class is
>> pretty much baked into Leo. For instance, g.app.db is an external file. Do
>> we really want to complicate the code by creating a dummy instance of
>> g.app.db in some cases?
>>
>
> I know there are many other examples of tight coupling throughout leo and
> you are just picking g.app.db as one, but for that case leobridge already
> uses g.NullObject for g.app.db, so the rest of leo code must already handle
> that case.
>

Thanks for these comments. We seem to be on the same page.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS10DDVk528FZy547aKh8rjPxEB2yMkYdT6P-1RrQfBvLg%40mail.gmail.com.

Reply via email to