cloudwego / cloudwego/abcoder

The import-reexport problem

Aperta
#54 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
390
Fork
57
Merge medio
2g 21h
PR unite (30g)
1

Descrizione

相关分支:https://github.com/cloudwego/abcoder/tree/fix/reexport

在 rust 和 python 中,存在一种情况是一个文件 import 了一个符号以后,从自己的位置 export 出去

```
// rust
// (文件是 cur.rs, pkgPath is cur)
mod foo; // 子模块是 private 的
pub use foo::bar; // 但是 bar 函数是 public 的
// 这个 pkg 的 user 应当通过 cur::bar 来访问 bar
// 不能通过 cur::foo::bar,会产生错误

// python
from math import cos // 当前文件 export 了 cos
```

在 Rust 的情况中,我们应当确保 cur::bar 是外部可见的.
现在的实现里,pkgPath=cur 的地方没有 bar,但是 pkgPath=cur::foo 里有 bar。
这可能让大模型认为 bar 的用法是 cur::foo::bar

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Use the linked fix/reexport branch as a starting point, then locate the code that records exported symbols by pkgPath. Compare the Rust cur::bar example with the current cur::foo::bar result, and check the Python import-reexport case. Done means the re-exported symbol is available from the current package path without exposing the private module path.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
go, python, rust
Ambito
compilers, devtools
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.