> Python's take on this is that if you want a bool, you use the bool 
> constructor `bool( <expr> )`; we could add a vimscript function (like 
> `string`) which takes an expr and returns either `v:true` or `v:false`, as 
> in `return bool( 'string' )` or `return bool( 99 )`. The semantics of the 
> type specified would have to determine how 'truthy' a value is. I think 
> that's already defined for vimscript as mentioned.

We already have the "!!" operator which most likely does the same thing.
Anyone writing Javascript or Typescript is common with using this.

Using bool() would also work, but I don't see a good reason to add
a second way.  We don't have much similarity with Python for
expressions.

As mentioned before, some users expect an expression like
"'yes' || 'no'" to result in "true" when used for a bool, like in a
condition of :if or :while.  I'm right now implementing that, and it
looks like it will work and feels natural.

Without "||" or "&&" you would still need to use "!!", which makes
sense, since using a string or number for a boolean value looks like a
mistake.

-- 
MONK: ... and the Lord spake, saying, "First shalt thou take out the Holy Pin,
      then shalt thou count to three, no more, no less.  Three shalt be the
      number thou shalt count, and the number of the counting shalt be three.
      Four shalt thou not count, neither count thou two, excepting that thou
      then proceed to three.  Five is right out.  Once the number three, being
      the third number, be reached, then lobbest thou thy Holy Hand Grenade of
      Antioch towards thou foe, who being naughty in my sight, shall snuff it.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202009091859.089IxOdD416238%40masaka.moolenaar.net.

Raspunde prin e-mail lui