Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Standardize the type of the request property in the dependencies #7797

Open
shulaoda opened this issue Sep 4, 2024 · 3 comments
Labels
tracking issue Category: A tracking issue for an RFC or an unstable feature.

Comments

@shulaoda
Copy link
Collaborator

shulaoda commented Sep 4, 2024

Description

I noticed that in some Dependencies, the types of requests are not consistent, some use String while others use Atom. What is the best choice? @h-a-n-a cc

#[derive(Debug, Clone)]
pub struct ImportEagerDependency {
id: DependencyId,
request: Atom,
range: RealDependencyLocation,
referenced_exports: Option<Vec<Atom>>,
attributes: Option<ImportAttributes>,
resource_identifier: String,
}

#[derive(Debug, Hash, PartialEq, Eq, Clone)]
pub struct EntryDependency {
id: DependencyId,
request: String,
context: Context,
layer: Option<ModuleLayer>,
is_global: bool,
}

@shulaoda shulaoda added the tracking issue Category: A tracking issue for an RFC or an unstable feature. label Sep 4, 2024
@shulaoda shulaoda changed the title [Tracking]: Standardize the type of the request property in the dependencies [Feat]: Standardize the type of the request property in the dependencies Sep 4, 2024
@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Sep 4, 2024

Thanks for raising this! This is probably related to the whole repo. I cannot make a quick conclusion at the moment. Let's make sure we are on the same page and provide as much information as possible before discussing this.

Some resources:

Things I believe:

  • Should keep dependency(string type) as small as possible as we don't want that much of heap allocations
  • String type(for dependencies and modules) should be lock-free globally as dependencies and modules are created parallely
  • We do not necessarily need to use only one string type. Different types should be suitable for different cases

Will get back to you soon as soon as I have some idea.

@shulaoda
Copy link
Collaborator Author

shulaoda commented Sep 4, 2024

Will get back to you soon as soon as I have some idea.

Thanks for your clarification!

@hardfist
Copy link
Contributor

hardfist commented Sep 4, 2024

I think we should at least use Request new type to unify request usage first

struct Request(Atom);

then we can investigate what's best implementation detail of how to store request

@shulaoda shulaoda changed the title [Feat]: Standardize the type of the request property in the dependencies [Feature]: Standardize the type of the request property in the dependencies Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracking issue Category: A tracking issue for an RFC or an unstable feature.
Projects
None yet
Development

No branches or pull requests

3 participants