Docs: Built in functions shadow user variables
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 62/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- go
調査の方向性
https://expr-lang.org/docs/language-definition の言語定義から始め、組み込み関数がどのようにドキュメント化されているかを確認してください。count > 0 のような名前の衝突に関する警告を追加し、回避策としての $env.count と、関数を無効化するための API オプションについて言及し、API ドキュメントへのリンクを含めてください。
索引モデルが issue の本文から書いたものです。
説明
Problem:
When using go-expr in default mode, functions are enabled. The function list includes some commonly defined variables, like count, and leads to expression compilation errors in cases like count > 0.
Solution:
The API exports functions that allow disabling a particular built-in function, or disabling them all. No implementation is necessary to work around the issue, and the issue also has other solutions like $env.count.
Proposal:
The language definition seems to be the canonical source of truth for which functions are implemented in go-expr. I'd like if a warning could be added that mentions the problem, and the option to disable the built in functions is possible via API.
Proposed text (discussion starter, MVP):
The built in functions may cause issues in evaluation when the variables share the same name. It's very common to use
count > 0expressions in simplistic checks, producing an error. You can change the expression to$env.countto avoid the issue. The API allows to disable built in functions, avoiding issues when you don't have control over the input and mainly want to use other features of expr like conditions and ternary operators. See the API documentation
- 主要言語
- Go
- スター
- 8k
- フォーク
- 529
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
expr-lang/expr のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
log2 builtin オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
-
enhancement needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
kind/cleanup
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
kubernetes-sigs/kueue#15947 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
sympozium-ai/sympozium#627 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100