nushell / nushell/nushell.github.io
Are Boolean operators lazy?
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 258
- フォーク
- 561
- 平均マージ
- 3時間 20分
- マージ済み PR(30日)
- 15
説明
Hello,
TL;DR: Are the and and or Boolean operators guaranteed to be lazy, so we can document it?
I encountered this bug https://github.com/nushell/nushell/issues/10237 which makes last error out on an empty input instead of returning a null if I understand correctly.
So I have written this workaround:
let filler = if ($text != "") and ($text | split chars | last) == "%" { "%" } else { " " }
This code works without errors for me, so the RHS of the and Boolean operator must not be evaluated / be lazily evaluated.
To put it short, the and operator seems lazy (nu version 0.108.0)
I cannot find it documented in Boolean | Nushell and looking for "lazy" in the documentation does not yield anything related to Booleans.
Is and guaranteed to be lazy in future versions? What about or?
Should we document this behavior?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている Boolean のドキュメントページと、参照されている Nushell の issue 10237 から始めてください。and と or が遅延評価されることが保証されているかを確認し、その後、確認できた動作と、適切な Boolean のドキュメントページにある示された例への影響を文書化してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- shell
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100