Skip to content

Remove LazyReference from code#38944

Merged
alalazo merged 8 commits intospack:developfrom
alalazo:refactor/remove_lazy_reference
Jul 19, 2023
Merged

Remove LazyReference from code#38944
alalazo merged 8 commits intospack:developfrom
alalazo:refactor/remove_lazy_reference

Conversation

@alalazo
Copy link
Copy Markdown
Member

@alalazo alalazo commented Jul 17, 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.

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 LazyReference class entirely, and access the attributes explicitly passing through the gloabl value to which they are attached.

Modifications:

  • Remove the LazyReference class
  • Uppercase the global spack.store.STORE variable
  • Remove spack.store.root (which becomes spack.store.STORE.root)
  • Remove spack.store.unpadded_root (which becomes spack.store.STORE.unpadded_root)
  • Remove spack.store.db (which becomes spack.store.STORE.db)
  • Remove spack.store.layout (which becomes spack.store.STORE.layout)

@alalazo alalazo force-pushed the refactor/remove_lazy_reference branch 2 times, most recently from 14e2fa9 to 5b623b0 Compare July 18, 2023 21:23
@alalazo alalazo force-pushed the refactor/remove_lazy_reference branch from 5b623b0 to 460debd Compare July 18, 2023 21:53
@alalazo alalazo merged commit a7f2abf into spack:develop Jul 19, 2023
@alalazo alalazo deleted the refactor/remove_lazy_reference branch July 19, 2023 09:08
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants