module import() behavior where the module only supports specific environments
Nobody has claimed this yet.
- Dominant language
- Vim Script
- Stars
- 587
- Forks
- 64
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 1
Description
https://github.com/vim-jp/vital.vim/pull/513#issuecomment-302925402 から派生。
要約
特定環境でのみ動くモジュールを import() した時、vital のモジュール全般においてどのような挙動にするべきかを話し合いたいです。
今出ている案は以下の通りです。
- import() 時に例外を投げる
- import() 時には例外を投げず、ユーザにチェック用メソッドを呼んでもらってチェックしてもらう
本文
#513 のモジュールの様に Vim 8 か NeoVim でしか動かないモジュールの場合、
サポートされない環境で import() した時に Vim 8 or NeoVim is required みたいな例外を投げたい場合もあるかと思いました。
しかし ujihisa さん曰く、ConcurrentProcess ではそのようになっていません(ユーザに is_available() でチェックしてもらう API になっている)。
インターフェースが統一されてるといいかと思ったので、vital ではどのようにすべきかを相談したいです。
- import() 時に例外を投げる
- メリット:チェック用メソッドを呼び忘れることがない
- デメリット:(2 の案のメリットの反対)import() をトップレベルで無条件に行うことができない
- import() 時には例外を投げず、ユーザにチェック用メソッドを呼んでもらってチェックしてもらう
- メリット:import() をトップレベルで無条件に行うことができる(catch する必要がない)
- デメリット:(1 の案のメリットの反対)チェック用メソッドを呼び忘れてしまう可能性がある
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked pull request #513 and its referenced comments, then review how ConcurrentProcess exposes is_available() for unsupported environments. Compare that behavior with the proposed import() exception approach and document or implement the agreed project-wide policy once a decision is reached.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vim
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100