Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

NullVoxPopuli
Copy link
Collaborator

Why?:

  • while trying to implement:
    This library is now a partial-polyfill for RFC#1068 tracked-tools/tracked-built-ins#440
    I ran in to an issue where dependencySatisfies was always returning false (because the peerDep was not declared). We can't declare the peerDep because then we force all consumers of tracked-built-ins to forward the peer. We've already learned that we can't successfully manage a fully correct package.json-declared dep graph. It's been best to just not declare peers, and rely on the resolve algo, as well as the assumption that the host app must provide ember-source.

Copy link
Member

@mansona mansona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a few things when I had a quick look. I know it's draft but I thought I would share 😂

try {
let root = state.packageCache.get(state.packageCache.appRoot);

if (!root?.hasDependency(packageName)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was a copyPasta error 🍝 because the packageName is in module scope.. . it's only used in this try block so we could just make it a const in here 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why spend the cost of re-defining a variable every function evaluation?
it makes more sense for consts to remain in module space

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that's premature optimisation right there, v8 will 100% inline it if it's a const 🤷

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, i mean, the activation energy to change it is worth more than anything the computer would do.
(and what energy is spent discussing such changes).

Additionally to my prior point, I use consts like this to avoid typos in strings.
I hate debugging string typos. So if I only write the word once, I can't have mismatches. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants