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

包管理机制 #5

Open
zhangzhimin opened this issue Mar 29, 2023 · 4 comments
Open

包管理机制 #5

zhangzhimin opened this issue Mar 29, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@zhangzhimin
Copy link
Contributor

目前的包管理基本没有实现. 包管理会是一个多阶段的工作.

  1. 实现基本的包管理机制, 在本地可以正确索引文件和库.
  2. 基于git的包管理, 形成项目的标准格式
  3. 自己实现的类型于pip的包管理, 目前来看是不没有必要, 每次需要发布也麻烦
@zhangzhimin zhangzhimin added enhancement New feature or request good first issue Good for newcomers labels Apr 16, 2023
@zhangzhimin
Copy link
Contributor Author

现在Prajna的Module管理是这样的, 比如"::gpu::Thread", ::表示从根符号表开始开始查找, 后面就是各个子模块的名字.
现在Prajna会强制根据文件路径来生成模块名, 比如examples/gpu/matrix_multiply会自动生成examples::gpu::matrix_multiply这样会省一些事情, 但同时也会导致模块名字容易重复, 并且错误难于排查.

需要充分借鉴一下Rust, Julia和C++的module(package)管理机制. 目前先不用过多关注发布和版本的管理.

@microctar
Copy link
Contributor

https://github.com/rust-lang/cargo/blob/bfb0d197d20a19f7cd811493081b4f769a1377cf/src/cargo/core/source/source_id.rs#L21

/// Cargo uniquely identifies packages using [PackageId], a combination of the
/// package name, version, and the code source. SourceId exactly represents
/// the "code source" in PackageId. See [SourceId::hash] to learn what are
/// taken into account for the uniqueness of a source.

@microctar
Copy link
Contributor

microctar commented Aug 5, 2023

用路径做模块(module)名是没有问题的,可以用as关键字为模块起别名避免冲突。编译器本身可以只管在指定路径下能否查找到模块。

错误排查可以考虑参照Rust,将完整的模块名抛出。

依赖及其路径应该由包管理器管理,包管理器为编译器提供包的路径,解决包名冲突和包之间的依赖关系。

关于包管理:
pnpm 将实际包路径链接到项目目录下。它是基于内容寻址存储设计的,能节省硬盘空间和包的更新成本。

nimble 是nim-lang的包管理器,相对于其他包管理器,它的实现相对简洁。

@zhangzhimin
Copy link
Contributor Author

用路径做模块(module)名是没有问题的,可以用as关键字为模块起别名避免冲突。编译器本身可以只管在指定路径下能否查找到模块。

错误排查可以考虑参照Rust,将完整的模块名抛出。

依赖及其路径应该由包管理器管理,包管理器为编译器提供包的路径,解决包名冲突和包之间的依赖关系。

关于包管理: pnpm 将实际包路径链接到项目目录下。它是基于内容寻址存储设计的,能节省硬盘空间和包的更新成本。

nimble 是nim-lang的包管理器,相对于其他包管理器,它的实现相对简洁。

现在错误是全名了, 清晰了点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants