Hi Nikita,
On Wed, Feb 5, 2014 at 3:21 PM, Nikita Popov <[email protected]> wrote:
> There is a difference between f() and 'f'. The former is a function call,
> the latter a callback. The eval-behavior non-withstanding assert is
> essentially if (!$arg1) { error($arg2); }. So if (!f()) { ... } makes a lot
> of sense, but if (!function() {}) {} makes zero sense. Again, function() {}
> only creates a callback, but does *not* run it. To run it, you'd need
> something like (function(){})().
Thank you for the explanation.
Current assert() is consistent as its spec, since it does not support
callable which is callback function.
I think assert() may accept closure. As I wrote in another mail,
assert(function() {
// some
// useful
// code
});
looks nicer and more modern.
Users are use to this as this kind of form is extensively used in
JavaScript.
I wish to have this form for new assert().
Regards,
--
Yasuo Ohgaki
[email protected]