Docs: Built in functions shadow user variables

オープン 初心者向け
#905 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1〜3時間
初心者へのやさしさ
62/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
go
領域
documentation

調査の方向性

https://expr-lang.org/docs/language-definition の言語定義から始め、組み込み関数がどのようにドキュメント化されているかを確認してください。count > 0 のような名前の衝突に関する警告を追加し、回避策としての $env.count と、関数を無効化するための API オプションについて言及し、API ドキュメントへのリンクを含めてください。

索引モデルが issue の本文から書いたものです。

説明

docs needed

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 > 0 expressions in simplistic checks, producing an error. You can change the expression to $env.count to 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 はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

expr-lang/expr のほかの issue

expr-lang/expr の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。