exist icon indicating copy to clipboard operation
exist copied to clipboard

Lazy loading model for module imports

Open rhubner opened this issue 3 years ago • 10 comments

This PR fixes #1848 by allowing the user to configure which modules should be loaded lazily.

It adds a new attribute load on the module element of conf.xml. If unspecified, modules are loaded automatically (i.e. eagerly) to maintain backwards compatibility with the previous eXist-db mode of operation.

The exist-distribution config file was updated to take advantage of this new feature. Only those modules that are deemed as required by eXist-db's XQSuite tests and Apps are loaded by default. Other modules can be loaded with import module namespace, for example:

import module namespace validation = "http://exist-db.org/xquery/validation";

This open source contribution to the eXist-db project was commissioned by the Office of the Historian, U.S. Department of State, https://history.state.gov/.

rhubner avatar Jul 13 '22 09:07 rhubner

Great work! Being non-native, I find the term "lazily" quite hard to remember, I think I see "lazy" more often, is shorter and IMO more clear whilst still correct?

dizzzz avatar Jul 26 '22 19:07 dizzzz

Great work! @adamretter are we completely sure that the code is backwards compatible? This line might show something different? (not sure)

image

is this PR a v7 candidate ? will old code still work?

dizzzz avatar Jul 26 '22 19:07 dizzzz

Great work! Being non-native, I find the term "lazily" quite hard to remember, I think I see "lazy" more often, is shorter and IMO more clear whilst still correct?

@dizzzz "lazily" is the adverb (modifies a verb), whilst "lazy" is the adjective (describes a state).

In this instance load="lazily" - so the verb is "load", and the adverb ("lazily") modifies that.

I think it makes sense, although for sure my English is not perfect either!

We can change it if you still want us to? Perhaps @joewiz has an opinion on this?

adamretter avatar Aug 03 '22 21:08 adamretter

I see benefits in standardizing on "lazy". Now the code has instances of both "lazy" and "lazily" (but only "eager" - not "eagerly" - instead "always"). Standardizing on just "lazy" and "eager" (and doing away with "lazily" and "always") would probably prevent people mixing up the different verb forms/words on their code/configurations.

joewiz avatar Aug 04 '22 18:08 joewiz

Standardizing on just "lazy" and "eager"

@joewiz We have now switched this to lazy and eager

adamretter avatar Oct 05 '22 20:10 adamretter

This change is a clear hint that this constitutes a breaking change.

@line-o Sure, the target for this is eXist-db 7.0.0.

adamretter avatar Oct 05 '22 20:10 adamretter

Tests are failing

line-o avatar Feb 21 '23 18:02 line-o