New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] empty() のドキュメントが不親切 #1088

Closed
mattn opened this Issue Sep 14, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@mattn
Member

mattn commented Sep 14, 2017

https://twitter.com/mattn_jp/status/908152437529239552

ちなみにですが、Vim script は len(str) より empty(str) の方が速いのでどんどん empty(str) 使って行こう。(Vim の話はしていない)

https://twitter.com/pink_bangbi/status/908188761007075328

これ、 :help empty() には文字列に対する記述は載っていないが、:if !empty("foo") みたいな example はドキュメントに乗っているので :help empty() にもちゃんと記述するべきではないだろうか #重箱の隅

という事で empty() の doc に少し手を入れた方が良いかもしれない。現状は以下

empty({expr})						*empty()*
		Return the Number 1 if {expr} is empty, zero otherwise.
		- A |List| or |Dictionary| is empty when it does not have any
		  items.
		- A Number and Float is empty when its value is zero.
		- |v:false|, |v:none| and |v:null| are empty, |v:true| is not.
		- A Job is empty when it failed to start.
		- A Channel is empty when it is closed.

		For a long |List| this is much faster than comparing the
		length with zero.

:help TRUE には一応例がある。

							*TRUE* *FALSE*
For boolean operators Numbers are used.  Zero is FALSE, non-zero is TRUE.
You can also use |v:false| and |v:true|.  When TRUE is returned from a
function it is the Number one, FALSE is the number zero.

Note that in the command: >
	:if "foo"
	:" NOT executed
"foo" is converted to 0, which means FALSE.  If the string starts with a
non-zero number it means TRUE: >
	:if "8foo"
	:" executed
To test for a non-empty string, use empty(): >
	:if !empty("foo")
@k-takata

This comment has been minimized.

Show comment
Hide comment
@k-takata
Member

k-takata commented Oct 4, 2017

いろいろまとめて投げました。
https://groups.google.com/d/topic/vim_dev/KlCEH3dI_rg/discussion

@k-takata

This comment has been minimized.

Show comment
Hide comment
Member

k-takata commented Nov 5, 2017

@k-takata k-takata closed this Nov 5, 2017

@k-takata k-takata added the xlose/fixed label Nov 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment