f-string interpolation calls `str` by name, so a user binding named `str` changes every f-string
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- c
- 領域
- compilers, testing-qa
調査の方向性
Start in the f-string block of src/lexer.c and inspect the lowering used by the VM, then compare the ouroboros frontend/AOT path. Run the two reproductions with EIGS_JIT_OFF=1 and use tests/test_fstrings.eigs as the regression-test entry point. Done means the global, defined, and function-local str cases produce the specified result or fail loudly, with both lowering paths aligned.
索引モデルが issue の本文から書いたものです。
説明
The lexer lowers f"a{e}b" to ("a" + (str of (e)) + "b") using an ordinary TOK_IDENT "str" (src/lexer.c, f-string block). That identifier is resolved like any other name at run time. A program that binds str therefore changes, or breaks, every f-string evaluated in that scope. Nothing in the source of the f-string mentions str.
Reproduce (origin/main 94c4c5b, release build)
define str(x) as:
return "HIJACK"
print of f"<{5}>"
Actual: exit 0, stdout <HIJACK>. Expected: <5> (or a loud error, if rebinding str is to be forbidden).
str is 3
print of f"<{str}>"
Actual: exit 1, Error line 2: cannot call num. The failing call is one the user never wrote.
The first case is a silent wrong answer (PRINCIPLES.md §2). A str local inside a function body does the same thing to every f-string in that function.
Done when
- f-string interpolation converts values with the builtin conversion no matter what
stris bound to in the enclosing scopes (for example, a dedicated opcode or a reserved internal name the user cannot bind). The alternative is a decision, recorded here, that rebindingstris an error. - Both programs above print
<5>and<3>(or fail loudly at the rebinding, if that is the decision), under the VM and withEIGS_JIT_OFF=1. - A regression in
tests/test_fstrings.eigscovers a globalstr, adefine str, and a function-localstr. - The ouroboros frontend/AOT mirror whatever lowering is chosen (it lowers f-strings the same way).
Found while fixing #1244, where the synthetic str token is now marked as having no source span so LSP rename never edits it; this issue is about the runtime meaning of that token.
- 主要言語
- C
- スター
- 3
- フォーク
- 7
- 平均マージ
- 3時間 56分
- マージ済み PR(30日)
- 102
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
InauguralSystems/EigenScript のほかの issue
-
area:lint-tooling bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
InauguralSystems/EigenScript#1340 ·
メンテナーはふだん 1 日以内に返信
-
area:stdlib found-by:code-review kind:silent-wrong
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
InauguralSystems/EigenScript#1338 ·
メンテナーはふだん 1 日以内に返信
-
area:lint-tooling found-by:critic kind:docs-drift
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
InauguralSystems/EigenScript#1335 ·
メンテナーはふだん 1 日以内に返信
-
area:ci found-by:critic kind:gate-defect
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
InauguralSystems/EigenScript#1311 ·
メンテナーはふだん 1 日以内に返信
-
enrolment: decide test_gc_runner_controls.py (exempt vs enrol) and whether floors need a ratchetオープンarea:gates found-by:critic kind:decision
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
InauguralSystems/EigenScript#1280 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
InauguralSystems/EigenScript の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
johnsonjh/emu2-cpm86#68 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Zenmap CrashオープンZenmap
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
fastfetch-cli/fastfetch#2619 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
Template: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
betaflight/betaflight#15759 ·
メンテナーはふだん 1 日以内に返信