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

Added external files. #6223

Merged
merged 1 commit into from
Aug 20, 2024
Merged

Added external files. #6223

merged 1 commit into from
Aug 20, 2024

Conversation

orizi
Copy link
Collaborator

@orizi orizi commented Aug 18, 2024

Stack:

⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.


This change is Reviewable

Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 16 of 16 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Arcticae, @Draggu, @mkaput, and @piotmag769)

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewed 16 of 16 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)


crates/cairo-lang-filesystem/src/ids.rs line 65 at r1 (raw file):

    OnDisk(PathBuf),
    Virtual(VirtualFile),
    External(u32),

please add:

struct ExternalFileId(u32)

to hide u32 as implementation detail

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @mkaput, and @piotmag769)


crates/cairo-lang-filesystem/src/ids.rs line 65 at r1 (raw file):

Previously, mkaput (Marek Kaput) wrote…

please add:

struct ExternalFileId(u32)

to hide u32 as implementation detail

this becomes a salsa::InternId in a followup PR - so not really sensible.

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)


crates/cairo-lang-filesystem/src/ids.rs line 65 at r1 (raw file):

Previously, orizi wrote…

this becomes a salsa::InternId in a followup PR - so not really sensible.

salsa::InternId is also an implementation-detail-kind type just like u32, isn't it?

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 16 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)


crates/cairo-lang-filesystem/src/db.rs line 111 at r1 (raw file):

/// A trait for defining files external to the `filesystem` crate.
pub trait ExternalFiles {

why couldn't this be just a new query group?

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Arcticae, @Draggu, @mkaput, and @piotmag769)


crates/cairo-lang-filesystem/src/db.rs line 111 at r1 (raw file):

Previously, mkaput (Marek Kaput) wrote…

why couldn't this be just a new query group?

how would that work?
the idea is using it by a QueryGroup that already depends on filesystem - so that would be a cyclic dependency.


crates/cairo-lang-filesystem/src/ids.rs line 65 at r1 (raw file):

Previously, mkaput (Marek Kaput) wrote…

salsa::InternId is also an implementation-detail-kind type just like u32, isn't it?

but that wrap is meaningless.

the entire idea is that it is an external implementation using another query - the wrapper type would not solve anything.

@orizi orizi force-pushed the pr/orizi/updates/dd8a62c8 branch 2 times, most recently from 039fad4 to efc94cf Compare August 20, 2024 03:43
@orizi orizi changed the base branch from main to pr/orizi/updates/e1b0c9fb August 20, 2024 03:43
commit-id:dd8a62c8
@orizi orizi changed the base branch from pr/orizi/updates/e1b0c9fb to main August 20, 2024 05:42
Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)


crates/cairo-lang-filesystem/src/db.rs line 111 at r1 (raw file):

Previously, orizi wrote…

how would that work?
the idea is using it by a QueryGroup that already depends on filesystem - so that would be a cyclic dependency.

closing this thread, I'll open new one with my recent thoughts on this


crates/cairo-lang-filesystem/src/ids.rs line 65 at r1 (raw file):

Previously, orizi wrote…

but that wrap is meaningless.

the entire idea is that it is an external implementation using another query - the wrapper type would not solve anything.

yeah, you're right it's meaningless in this context. resolving this thread but I'll post my thoughts in another one


crates/cairo-lang-filesystem/src/ids.rs line 66 at r2 (raw file):

    Virtual(VirtualFile),
    External(u32),
}

The more I think and try to reason about this, the more I believe this is an unnecessary abstraction. Why can't we just put plugin generated file ID here directly? This should reduce much of the indirections that are happening here, and thus make the code easier to reason about + I really don't believe we'll need another file generation method anytime soon.

Suggestion:

pub enum FileLongId {
    OnDisk(PathBuf),
    Virtual(VirtualFile),
    PluginGenerated(PluginGeneratedFileId),
}

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @mkaput, and @piotmag769)


crates/cairo-lang-filesystem/src/ids.rs line 66 at r2 (raw file):

Previously, mkaput (Marek Kaput) wrote…

The more I think and try to reason about this, the more I believe this is an unnecessary abstraction. Why can't we just put plugin generated file ID here directly? This should reduce much of the indirections that are happening here, and thus make the code easier to reason about + I really don't believe we'll need another file generation method anytime soon.

this is a circular dependency - the entire idea is to break it.

Copy link
Contributor

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Arcticae, @Draggu, and @piotmag769)

@orizi orizi added this pull request to the merge queue Aug 20, 2024
Merged via the queue into main with commit 4ee65fa Aug 20, 2024
44 checks passed
@orizi orizi deleted the pr/orizi/updates/dd8a62c8 branch August 20, 2024 14:02
@piotmag769 piotmag769 removed their request for review August 22, 2024 10:09
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.

3 participants