Remove LazyReference from code#38944
Merged
alalazo merged 8 commits intospack:developfrom Jul 19, 2023
Merged
Conversation
14e2fa9 to
5b623b0
Compare
Before it was working because it was evaluating equality against a lazy reference
5b623b0 to
460debd
Compare
haampie
approved these changes
Jul 19, 2023
eugeneswalker
pushed a commit
to eugeneswalker/spack
that referenced
this pull request
Jul 22, 2023
A LazyReference object is a reference to an attribute of a lazily evaluated singleton. Its only purpose is to let developers use shorter names to refer to such attribute. This class does more harm than good, as it obfuscates the fact that we are using the attribute of a global object. Also, it can easily go out of sync with the singleton it refers to if, for instance, the singleton is updated but the references are not. This commit removes the LazyReference class entirely, and access the attributes explicitly passing through the global value to which they are attached.
tmadlener
added a commit
to tmadlener/k4-spack
that referenced
this pull request
Jul 24, 2023
mpokorny
pushed a commit
to mpokorny/spack
that referenced
this pull request
Sep 18, 2023
A LazyReference object is a reference to an attribute of a lazily evaluated singleton. Its only purpose is to let developers use shorter names to refer to such attribute. This class does more harm than good, as it obfuscates the fact that we are using the attribute of a global object. Also, it can easily go out of sync with the singleton it refers to if, for instance, the singleton is updated but the references are not. This commit removes the LazyReference class entirely, and access the attributes explicitly passing through the global value to which they are attached.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
LazyReferenceobject is a reference to an attribute of a lazily evaluated singleton. Its only purpose is to let developers use shorter names to refer to such attribute.I think this class does more harm than good, as it obfuscates the fact that we are using the attribute of a global object. Also, it can easily go out of sync with the singleton it refers to if, for instance, the singleton is updated but the references are not.
This PR removes the
LazyReferenceclass entirely, and access the attributes explicitly passing through the gloabl value to which they are attached.Modifications:
LazyReferenceclassspack.store.STOREvariablespack.store.root(which becomesspack.store.STORE.root)spack.store.unpadded_root(which becomesspack.store.STORE.unpadded_root)spack.store.db(which becomesspack.store.STORE.db)spack.store.layout(which becomesspack.store.STORE.layout)